I\'m very new to rpy2, as well as R.
I basically have a R script, script.R, which contains functions, such as rfunc(folder). It is located in the same directory as m
source
is a r
function, which runs a r
source file. Therefore in rpy2
, we have two ways to call it, either:
import rpy2.robjects as robjects
r = robjects.r
r['source']('script.R')
or
import rpy2.robjects as robjects
r = robjects.r
r.source('script.R')
r[r.source("script.R")]
is a wrong way to do it.
Same idea may apply to the next line.