All published worksheets from http://sagenb.org
Image: ubuntu2004
First, let's make simple analysis inside R. We have to use png drawing device and silent return value of dev.off function call, it's not necessary but reasonable thing to do.
We will be accessing x and y inside Sage, so we need small interface functions on both R and Sage side:
We create copies of R variables in Sage:
We have to look out for starting indices on both sides!
Also, remember that those are copies of variables, not references!
But of course we can copy those values back to R:
That way, we can make a plot of same data using Sage plotting capabilities:
Or using "r-dot" interface:
But remember that such call creates new variables named sage* inside Rs environment:
There is also one thing to look out for, passing strings. If you pass strings as it, using "value", expect to get something like:
or:
To get the names, you have to quote the quotes, so use '"value"' or "'value'" like in:
It's not much, but actually it is enough to get you started if you already know R and want to use it from Sage.