# Also get a string if you want (no copy/paste)str(x)
' 1 2 3'
# The global variable "r" in a Sage worksheet is just a Jupyter kernel, and it has# no useful "magic" regarding interfacing with the sage session. Use sage.all.r,# which is a pexpect interface to R and is very powerful for this. Alternatively,# if your data is HUGE, then use rpy2.r??
File:/cocalc/lib/python2.7/site-packages/smc_sagews/sage_salvus.pySource:defr(code=None,**kwargs):r""" Run R code in a sage worksheet. INPUT: - ``code`` -- a string containing code Use as a decorator. For example, put this in a cell and evaluate it to see a scatter plot of built-in mtcars dataframe variables `mpg` vs `wt`:: %r with(mtcars,plot(wt,mpg)) .. note:: SMC %r mode uses the jupyter `ir` kernel. """ifr.jupyter_kernelisNone:r.jupyter_kernel=jupyter("ir")r.jupyter_kernel('options(repr.plot.res = 240)')r.jupyter_kernel.smc_image_scaling=.5returnr.jupyter_kernel(code,**kwargs)