Description Usage Arguments Details Value References Examples
Interface for using python from R via Jython
1 |
jython.jar |
Optional alternative location of the jython.jar file. The package is distributed with its 'jython.jar' file, but the user can invoke their own by providing its path. |
modules |
List containing optional paths for required modules. Packages utilizing rJython can add their own extra python modules to the 'inst' directory and then add their base path using function |
This function is not primarily intended to be run directly by users but to be used by R packages with python dependencies. Their authors are invited to hide the internals of this package in their code at their convenience.
An object of class rJava that can exectute python code as per the examples below.
http://rsympy.googlecode.com, http://www.jython.org/Project/, http://www.jython.org/javadoc/org/python/util/PythonInterpreter.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | rJython <- rJython()
# Now you can use the rJava low level interface
rJython$exec( "a = 2*2" )
four <- rJython$get("a")
.jstrVal( four )
# Alternatively, a higher level interface is provided by the rJython package:
a <- 1:4
jython.assign( rJython, "a", a )
jython.exec( rJython, "b = len( a )" )
jython.get( rJython, "b" )
## Not run:
# If package 'foo' contains python code that depends on module 'mod',
# 'mod' can be included in the 'inst' directory of the package.
# Then, in order to make it available to Jython, the interpreter can be
# started as follows:
rJython <- rJython( modules = system.file("python-modules", package = "foo") )
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.