@@ -297,13 +297,12 @@ def _setup_r_to_sage_converter():
297
297
Set up a the converter used to convert from rpy2's
298
298
representation of R objects to the one sage expects.
299
299
300
- EXAMPLES::
301
-
302
- Test
300
+ EXAMPLES:
303
301
304
- Simple numeric values are represented as vectors in R. So `1` would actually
305
- be an array of length 1. We convert all vectors of length 1 to simple values,
306
- whether or not they "originally" were simple values or not:
302
+ Simple numeric values are represented as vectors in R. So `1`
303
+ would actually be an array of length 1. We convert all vectors of
304
+ length 1 to simple values, whether or not they "originally" were
305
+ simple values or not::
307
306
308
307
sage: r([42]).sage() # optional - rpy2
309
308
42
@@ -314,27 +313,27 @@ def _setup_r_to_sage_converter():
314
313
sage: r('c("foo")').sage() # optional - rpy2
315
314
'foo'
316
315
317
- Arrays of length greater than one are treated normally:
316
+ Arrays of length greater than one are treated normally::
318
317
319
318
sage: r([42, 43]).sage() # optional - rpy2
320
319
[42, 43]
321
320
322
321
We also convert all numeric values to integers if that is possible without
323
- loss of precision:
322
+ loss of precision::
324
323
325
324
sage: type(r([1.0]).sage()) == int # optional - rpy2
326
325
True
327
326
328
327
sage: r([1.0, 42.5]).sage() # optional - rpy2
329
328
[1, 42.5]
330
329
331
- Matrices are converted to sage matrices:
330
+ Matrices are converted to sage matrices::
332
331
333
332
sage: r('matrix(c(2,4,3,1,5,7), nrow=2, ncol=3)').sage() # optional - rpy2
334
333
[2 3 5]
335
334
[4 1 7]
336
335
337
- More complex r structures are represented by dictionaries:
336
+ More complex r structures are represented by dictionaries::
338
337
339
338
sage: r.summary(1).sage() # optional - rpy2
340
339
{'DATA': [1, 1, 1, 1, 1, 1],
@@ -345,7 +344,7 @@ def _setup_r_to_sage_converter():
345
344
{'DATA': {'width': 60}, '_Names': 'width'}
346
345
347
346
The conversion can handle "not a number", infintiy, imaginary values and
348
- missing values:
347
+ missing values::
349
348
350
349
sage: r(-17).sqrt().sage() # optional - rpy2
351
350
nan
@@ -356,8 +355,7 @@ def _setup_r_to_sage_converter():
356
355
sage: inf = r('Inf'); inf.sage() # optional - rpy2
357
356
inf
358
357
359
-
360
- Character Vectors are represented by regular python arrays:
358
+ Character Vectors are represented by regular python arrays::
361
359
362
360
sage: labs = r.paste('c("X","Y")', '1:10', sep='""'); labs.sage() # optional - rpy2
363
361
['X1', 'Y2', 'X3', 'Y4', 'X5', 'Y6', 'X7', 'Y8', 'X9', 'Y10']
@@ -503,9 +501,9 @@ def _lazy_init(self):
503
501
the blas implementation that is used.
504
502
For details, see https://bitbucket.org/rpy2/rpy2/issues/491.
505
503
506
- TESTS::
504
+ TESTS:
507
505
508
- Initialization happens on eval:
506
+ Initialization happens on eval::
509
507
510
508
sage: my_r = R() # optional - rpy2
511
509
sage: my_r._initialized # optional - rpy2
@@ -1391,6 +1389,7 @@ def __getitem__(self, s):
1391
1389
INPUT:
1392
1390
1393
1391
- s -- a string
1392
+
1394
1393
OUTPUT: RFunction -- the R function that in R has name s
1395
1394
1396
1395
EXAMPLES::
@@ -2061,13 +2060,14 @@ def r_version():
2061
2060
"""
2062
2061
return r .version ()
2063
2062
2063
+
2064
2064
class HelpExpression (str ):
2065
2065
"""
2066
2066
Used to improve printing of output of r.help.
2067
2067
"""
2068
2068
def __repr__ (self ):
2069
- """
2070
- Return string representation of self.
2069
+ r """
2070
+ Return string representation of `` self`` .
2071
2071
2072
2072
OUTPUT: string
2073
2073
@@ -2082,4 +2082,3 @@ def __repr__(self):
2082
2082
R!
2083
2083
"""
2084
2084
return str (self )
2085
-
0 commit comments