rnode.jsmathintegrate

Integrate R with NodeJS


I'm new in Node and I'm searching for a way to integrate Node js with the R compiler. How can i run a R script in Node or maybe compile it with R and then get the result ? Thanks

I need something like this

...

// i need to compile and get the result of a R file like this
// the R script returns a number between 0 and 100
var exp = compileRFile(" **file location** ");

if (exp <= 0.1){
    console.log(`your exp ${exp} is lower than 0.1`);
}else {

...

Solution

  • I would suggest using the "r-integration" package. This library allows you to execute arbitrary R commands or scripts(files) from the Node JS environment by using system calls.

    To install it in your Node JS project just run npm install r-integration

    You can find more info about it here: r-integration