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>), |
|
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 |
|
|
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 |
|
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,13 +436,14 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 |
|
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 |
....: |
|
445 | ....: summary(lm(Y~X)) | |
444 | ....: |
|
446 | ||
445 |
|
||||
446 | Call: |
|
447 | Call: | |
447 | lm(formula = Y ~ X) |
|
448 | lm(formula = Y ~ X) | |
448 |
|
449 |
General Comments 0
You need to be logged in to leave comments.
Login now