Amrita Ray
2016-09-05 17:32:28 UTC
I am trying to call some R scripts from nodejs. I found out from the net
that a simple npm module called r-script is all I need to do this. I
installed it and then wrote this simple program.
var R = require("r-script");
var out = R("C:\Users\IBM_ADMIN\Documents\Amrita-Documents\BAT Pricing
Analytics\a-test.R")
.data(10)
.callSync();
console.log(out);
The R script a-test.R looks like this.
Square <- function(input) {
return(input^2)
}
res <-Square(3)
print(res)
I have tried this dozens of times but getting the same output.
C:\Users\IBM_ADMIN\Documents\Amrita-Documents\NodeJS\My Sample Codes>node
r-code
.js
null
Can anyone please help?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/82f128cc-c479-4615-8cb4-3617090c24ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
that a simple npm module called r-script is all I need to do this. I
installed it and then wrote this simple program.
var R = require("r-script");
var out = R("C:\Users\IBM_ADMIN\Documents\Amrita-Documents\BAT Pricing
Analytics\a-test.R")
.data(10)
.callSync();
console.log(out);
The R script a-test.R looks like this.
Square <- function(input) {
return(input^2)
}
res <-Square(3)
print(res)
I have tried this dozens of times but getting the same output.
C:\Users\IBM_ADMIN\Documents\Amrita-Documents\NodeJS\My Sample Codes>node
r-code
.js
null
Can anyone please help?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/82f128cc-c479-4615-8cb4-3617090c24ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.