python.assign: Assign and get variables in Python from R

Description Usage Arguments Details Value References Examples

Description

Functions that assign and get Python variables from R.

Usage

1
2
  python.assign(var.name, value, ...)
  python.get(var.name)

Arguments

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

...

other arguments passed to the internal toJSON function call

Details

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.

Value

Function python.get returns a R version of the Python variable py.var.

References

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

Examples

1
2
3
4
5
6
7
a <- 1:4
python.assign( "a", a )
python.exec( "b = len( a )" )
python.get( "b" )

python.exec( "import math" )
python.get( "math.pi" )

cjgb/rPython-win documentation built on May 13, 2019, 7:32 p.m.