Learn R Programming

rJython (version 0.0-4)

jython.exec: jython.exec

Description

Executes python code via the Jython interpreter

Usage

jython.exec( rJython, python.code )

Arguments

rJython
rJython interpreter as instantiated by function rJython
python.code
a character vector containing python code, typically containing a single line with indentation and EOL characters as required by Python syntax

Value

None. If the code produces some output, it is up to the caller to go and fetch if from Jython.

Details

This function runs Python code. It needs to be provided by the caller in a character vector.

The vector may consists of a single string with EOL and indentation characters embedded.

Alternatively, it can be a character vector, each entry containing one or more lines of python code.

References

http://code.google.com/p/simplejson

Examples

Run this code

rJython <- rJython()

a <- 1:4
b <- 5:8
jython.exec( rJython, c( "def concat(a,b):", "\treturn a+b" ) )
jython.call( rJython, "concat", a, b)


Run the code above in your browser using DataLab