This is my express server structure
--routes
----index.js
----graph.js
--scripts
----test.R
--server.js
I am trying to call R script from graph.js file as below
router.get('/test',function(req,res,next){
var R = require("r-script");
var out = R("./scripts/test.R")
.data()
.callSync();
res.send(out);
});
But I am getting the following error
TypeError: Cannot read property 'data' of undefined.
Any help is greatly appreciated. Thanks
R("../scripts/test.R")with an extra.. I think it's calling it relative to thegraph.js, notserver.js.