Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
More # optional - rpy2
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Feb 21, 2021
1 parent 4403924 commit 405ebb9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
17 changes: 9 additions & 8 deletions src/doc/en/prep/Quickstarts/Statistics-and-Distributions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,13 @@ the examples in ``r.kruskal_test?`` in the notebook.

::

sage: x=r([2.9, 3.0, 2.5, 2.6, 3.2]) # normal subjects
sage: y=r([3.8, 2.7, 4.0, 2.4]) # with obstructive airway disease
sage: z=r([2.8, 3.4, 3.7, 2.2, 2.0]) # with asbestosis
sage: a = r([x,y,z]) # make a long R vector of all the data
sage: b = r.factor(5*[1]+4*[2]+5*[3]) # create something for R to tell which subjects are which
sage: a; b # show them
sage: x=r([2.9, 3.0, 2.5, 2.6, 3.2]) # normal subjects # optional - rpy2
sage: y=r([3.8, 2.7, 4.0, 2.4]) # with obstructive airway disease # optional - rpy2
sage: z=r([2.8, 3.4, 3.7, 2.2, 2.0]) # with asbestosis # optional - rpy2
sage: a = r([x,y,z]) # make a long R vector of all the data # optional - rpy2
sage: b = r.factor(5*[1]+4*[2]+5*[3]) # create something for R to tell # optional - rpy2
....: # which subjects are which
sage: a; b # show them # optional - rpy2
[1] 2.9 3.0 2.5 2.6 3.2 3.8 2.7 4.0 2.4 2.8 3.4 3.7 2.2 2.0
[1] 1 1 1 1 1 2 2 2 2 3 3 3 3 3
Levels: 1 2 3
Expand All @@ -160,7 +161,7 @@ the examples in ``r.kruskal_test?`` in the notebook.
::

sage: r.kruskal_test(a,b) # do the KW test!
sage: r.kruskal_test(a,b) # do the KW test! # optional - rpy2
Kruskal-Wallis rank sum test

data: sage17 and sage33
Expand All @@ -178,7 +179,7 @@ Notice that R also uses the ``#`` symbol to indicate comments.
::

sage: %r
sage: %r # optional - rpy2
....: x = c(18,23,25,35,65,54,34,56,72,19,23,42,18,39,37) # ages of individuals
....: y = c(202,186,187,180,156,169,174,172,153,199,193,174,198,183,178) # maximum heart rate of each one
....: png() # turn on plotting
Expand Down
21 changes: 11 additions & 10 deletions src/sage/interfaces/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,9 @@ def __reduce__(self):
"abc"
sage: loads(dumps(pari([1,2,3])))
[1, 2, 3]
sage: loads(dumps(r('"abc"')))
sage: loads(dumps(r('"abc"'))) # optional - rpy2
[1] "abc"
sage: loads(dumps(r([1,2,3])))
sage: loads(dumps(r([1,2,3]))) # optional - rpy2
[1] 1 2 3
sage: loads(dumps(maxima([1,2,3])))
[1,2,3]
Expand Down Expand Up @@ -851,10 +851,11 @@ def _reduce(self):
by the doctests because the original identifier was reused. This test makes sure
that does not happen again:
sage: a = r("'abc'")
sage: b = dumps(a)
sage: r.set(a.name(), 0) # make identifier reuse doesn't accidentally lead to success
sage: loads(b)
sage: a = r("'abc'") # optional - rpy2
sage: b = dumps(a) # optional - rpy2
sage: r.set(a.name(), 0) # make sure that identifier reuse # optional - rpy2
....: # does not accidentally lead to success
sage: loads(b) # optional - rpy2
[1] "abc"
"""
Expand Down Expand Up @@ -1376,13 +1377,13 @@ def name(self, new_name=None):
EXAMPLES::
sage: x = r([1,2,3]); x
sage: x = r([1,2,3]); x # optional - rpy2
[1] 1 2 3
sage: x.name()
sage: x.name() # optional - rpy2
'sage...'
sage: x = r([1,2,3]).name('x'); x
sage: x = r([1,2,3]).name('x'); x # optional - rpy2
[1] 1 2 3
sage: x.name()
sage: x.name() # optional - rpy2
'x'
::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/sageinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ def foo(x, a='\')"', b={not (2+1==3):'bar'}): return
The following produced a syntax error before the patch at :trac:`11913`,
see also :trac:`26906`::
sage: sage.misc.sageinspect.sage_getargspec(r.lm)
sage: sage.misc.sageinspect.sage_getargspec(r.lm) # optional - rpy2
ArgSpec(args=['self'], varargs='args', keywords='kwds', defaults=None)
The following was fixed in :trac:`16309`::
Expand Down

0 comments on commit 405ebb9

Please sign in to comment.