Tag: rscript

从node.js调用Rscript

我一直在试图从我的node.js服务器执行Rscript。 试图在网上一个例子,但我不断收到一个null返回的对象或有时过程一直运行到永远。 我已经提到了下面的代码片段。 谢谢。 example.js :: var R = require("r-script"); var out = R("scripts/testScript.R") .data("hello world", 20) .callSync(function(err,resp){ console.log(out); }); testScript.R文件::: needs(magrittr) set.seed(512) do.call(rep, input) %>% strsplit(NULL) %>% sapply(sample) %>% apply(2, paste, collapse = "")