diff --git a/IPython/extensions/rmagic.py b/IPython/extensions/rmagic.py index 82d73ac..827f91a 100644 --- a/IPython/extensions/rmagic.py +++ b/IPython/extensions/rmagic.py @@ -188,13 +188,13 @@ class RMagics(Magics): Returns the output to R's stdout() connection, and the value generated by evaluating the code (see below) - In line mode (ie called with %R ), behavior - is unchanged, returns a python object representing - the final value, suitable for assignment into a - python variable. + In line mode (ie called with %R ), resulting + values are not printed (explicit calls to the + show/print R functions still result in properly + captured R output). In cell mode (called with %%R ...), behavior - now reproduces the REPL behavior of the R + reproduces the REPL behavior of the R interpreter (which agrees with how cells of python code are handled by the notebook). @@ -204,8 +204,8 @@ class RMagics(Magics): invisibly, the value will be printed using the show R function. - Actual evaluation of R code is done via a call - of the form withVisible({}) + Actual evaluation of R code is done via an R + call of the form withVisible({}) ''' old_writeconsole = ri.get_writeconsole() @@ -436,13 +436,14 @@ class RMagics(Magics): In [9]: %R X=c(1,4,5,7); sd(X); mean(X) Out[9]: array([ 4.25]) - As a cell, this will run a block of R code, without bringing anything back by default:: + As a cell, this will run a block of R code. By default the resulting value + is printed if it would be when evaluating the same code within an R REPL. + Nothing is returned to python by default. In [10]: %%R ....: Y = c(2,4,3,9) - ....: print(summary(lm(Y~X))) - ....: - + ....: summary(lm(Y~X)) + Call: lm(formula = Y ~ X)