Best
I've a R-script, which is located on my amazon S3 Bucket.
What I want to do is, I would like to create a python 2.7 programm which can run R-scripts, (which are located and streamed via a S3-bucket).
To do this, i would like to use the rpy2 library (without downloading the script itself temp. (thus : s3.get_object()
unstead of s3.download_file()
)).
Main question:
how do I load, the R-script into R, without downloading it. because :
def __init__(self, r_script):
self._r = robjects.r
self._r.source(r_script.read())
or
def __init__(self, r_script):
self._r = robjects.r
self._r.source(r_script)
Doesn't work ... because it is not a location-string but already the code itself
Here is the content of my test script :
rm(list = ls())
test1<- function(){}
test2<- function(){}
test3<- function(){}
execute<- function(){
a <- c(1,2,3)
c <- c(1,2,3)
b <- c(1,2,3)
r <- data.frame(a,b,c)
return(r)
}
- Actually, I think it would be already fine, if I could parse a big block of code, like the above, as a R script. (because, r_script.read(), is ~ a big string (I think))
Kind regards