shane shane - 19 days ago 6
R Question

arguments to python script from R

I have to pass some values to a python script and get some values back from it in R. I am presently using rPython library in R. I am able to get values from script using

python.get(var_name)
. How can I send values to python script?

Anything other than rPython which can help me do this is also appreciated.

Answer

python.assign seems to be the function you need.

From the package documentation for RPython:

Description
    Functions that assign and get Python variables from R.
Usage
    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 cal