Reputation: 466
From my Jupyter/IPython notebook I need to run an R script from a terminal command, using a Python variable as input:
x = "Owen"
! Rscript ./sayHello.R x
However, the variable x
is not recognized (ie. Python namespace is not included). How can you address this?
Upvotes: 0
Views: 920
Reputation: 466
Solution: Enclose variables in braces:
x = "Owen"
! Rscript ./sayHello.R {x}
or prefix by a $
sign:
x = "Owen"
! Rscript ./sayHello.R $x
Upvotes: 2