node-rscript
Simple package for running R code from node, and passing large amounts of data back and forth.
Documentation
const nodeR = /** * Uses R to run the script provided. * @param * @param * @returns */
Example
This creates a chart in R from data passed in in node.
const nodeR = ;const fsp = promises; const data = graph: x: 10 20 30 40 y: 10 20 30 40 ; fsp ;
library(jsonlite) graph = input$graph filename = tempfile(fileext = ".png", tmpdir=input$tempdir)png(filename=filename)result = plot(graph$x, graph$y,main = "test", sub = "test sub",xlab = "x", ylab = "y",xlim = c(0, 100), ylim = c(0, 100))# dev.off() # make the equivelent of a json objectoutput <- list(filename = filename) jsonlite::toJSON(output)