I want to pass a chunk of Python code to Python in R with something like system(\'python ...\')
, and I\'m wondering if there is an easy way to emulate the pytho
The system command has an option called intern = FALSE
. Make this TRUE
and Whatever output was just visible before, will be stored in a variable.
Now run your system command with this option and you should get your output directly in your variable. Like this
tmp <- system("python -c 'print \"hello world\"'",intern=T)