Closed liyuqi closed 10 years ago
Hey, I am out of town.
You may give a look at the second example (examples/ex2.js).
Basically you pass a json object and in R script you can extract the params using the RJSONIO package.
The same approach is used for the returned values.
Hope that helps.
Any news?
thanks alot
i solve it by using example/ex2.js.
the R reads exactly what args pass to
ex: Rmongo.js
var args = {
db:'rmongodb', collection:'iris',
xdata:'Petal.Length', ydata:'Petal.Width',
xlab:'Petal.length', ylab:'petal.width1'
};
test.R
...
src = fromJSON(data);
cursor <-mongo.find(mongo,paste(src['db'],src['collection'],sep='.'),query='{}');
...
plot(res[,src['xdata']],res[,src['ydata']],xlab=src['xlab'],ylab=src['ylab']);
How to pass arguments from node to Rserve, that takes the string from database?
ex:
Rmongo.js
test.R
i use Rserve for ploting image...
environment : node - Rserve - mongoDB environment = web - statistic - data
or take a look at https://github.com/kriloBT/nodeSS/tree/master/test_rmongo