##// END OF EJS Templates
made docstrings clearer and more explicit/correct for eval and R methods
gmbecker -
Show More
@@ -188,13 +188,13 b' class RMagics(Magics):'
188 Returns the output to R's stdout() connection, and
188 Returns the output to R's stdout() connection, and
189 the value generated by evaluating the code (see below)
189 the value generated by evaluating the code (see below)
190
190
191 In line mode (ie called with %R <stuff>), behavior
191 In line mode (ie called with %R <stuff>), resulting
192 is unchanged, returns a python object representing
192 values are not printed (explicit calls to the
193 the final value, suitable for assignment into a
193 show/print R functions still result in properly
194 python variable.
194 captured R output).
195
195
196 In cell mode (called with %%R ...), behavior
196 In cell mode (called with %%R ...), behavior
197 now reproduces the REPL behavior of the R
197 reproduces the REPL behavior of the R
198 interpreter (which agrees with how cells of
198 interpreter (which agrees with how cells of
199 python code are handled by the notebook).
199 python code are handled by the notebook).
200
200
@@ -204,8 +204,8 b' class RMagics(Magics):'
204 invisibly, the value will be printed using the
204 invisibly, the value will be printed using the
205 show R function.
205 show R function.
206
206
207 Actual evaluation of R code is done via a call
207 Actual evaluation of R code is done via an R
208 of the form withVisible({<code>})
208 call of the form withVisible({<code>})
209
209
210 '''
210 '''
211 old_writeconsole = ri.get_writeconsole()
211 old_writeconsole = ri.get_writeconsole()
@@ -436,12 +436,13 b' class RMagics(Magics):'
436 In [9]: %R X=c(1,4,5,7); sd(X); mean(X)
436 In [9]: %R X=c(1,4,5,7); sd(X); mean(X)
437 Out[9]: array([ 4.25])
437 Out[9]: array([ 4.25])
438
438
439 As a cell, this will run a block of R code, without bringing anything back by default::
439 As a cell, this will run a block of R code. By default the resulting value
440 is printed if it would be when evaluating the same code within an R REPL.
441 Nothing is returned to python by default.
440
442
441 In [10]: %%R
443 In [10]: %%R
442 ....: Y = c(2,4,3,9)
444 ....: Y = c(2,4,3,9)
443 ....: print(summary(lm(Y~X)))
445 ....: summary(lm(Y~X))
444 ....:
445
446
446 Call:
447 Call:
447 lm(formula = Y ~ X)
448 lm(formula = Y ~ X)
General Comments 0
You need to be logged in to leave comments. Login now