简体   繁体   English

R中python脚本的参数

[英]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) . 我必须将一些值传递给python脚本,并在R中从中获取一些值。目前,我在R中使用rPython库。我能够使用python.get(var_name)从脚本中获取值。 How can I send values to python script? 如何将值发送到python脚本?
Anything other than rPython which can help me do this is also appreciated. 除了rPython以外,任何可以帮助我做到这一点的功能也将受到赞赏。

python.assign seems to be the function you need. python.assign似乎是您需要的功能。

From the package documentation for RPython: 从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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM