Reputation: 1
I am trying to use nodejs with R, how to Execute R algorithm via Node.Js and get the results.
Upvotes: 0
Views: 1217
Reputation: 29172
Upvotes: 0
Reputation: 1422
Check out exec, a node module to run terminal statements.
Example:
var exec = require('exec')
exec('code to run my R script', function(err, response) {
if (err instanceof Error) throw err;
if (err) {
console.error('Something went wrong', err);
process.stderr.write(err);
}
// R output
console.log('All good', response);
process.stdout.write(response);
process.exit(1);
});
child_process
is also a valid alternative. Checkout this: Run R script and display graph using node.js
Upvotes: 2