Description Usage Arguments Details Value References Examples
View source: R/jython.assign.R
Functions that assign and get Python variables from R.
1 2 | jython.assign( rJython, var.name, value )
jython.get( rJython, py.var )
|
rJython |
rJython interpreter as instantiated by function |
var.name |
a character string containing a valid python variable name |
value |
an R object whose equivalent wants to be assigned to the variable in python |
py.var |
Name of a python variable |
These functions can assign values to variables in Python as well as get their values back to R. Objects are serialized as json strings while being transferred between R and Python.
Function jython.get
returns a R version of the Python variable py.var
.
http://code.google.com/p/simplejson
1 2 3 4 5 6 7 8 9 | rJython <- rJython()
a <- 1:4
jython.assign( rJython, "a", a )
jython.exec( rJython, "b = len( a )" )
jython.get( rJython, "b" )
rJython$exec( "import math" )
jython.get( rJython, "math.pi" )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.