rtest = function(input ,output) {
a <- input
b <- output
outpath <- a+b
print(a+b)
return(outpath)
}
I have just return this R code for as a function for getting sum of two numbers. I tried to run this function from my python code using subprocess by passing 2 numbers as arguments. But it does not return sum value as return output. Do you know any method for implement this in python3 by passing function arguments.
my python code using subprocess is:
args=['3','10'] # (i tried to pass aruments like this)
command="Rscript"
path2script = '/...path/rtest.R'
cmd = [command, path2script] +args
x = subprocess.check_output(cmd, universal_newlines=True)
print(x)
but x return ' ' null value