1

I have two very simple files to test my integration setup. First the r script inside test.R:

print('hello')

Then the index.js calling that file:

var R = require("r-script");
var out = R("./test.R")
           .data()
           .callSync();

And this is what my console is telling me:

$ node index.js
/home/user/index.js:3
  .data()
  ^

TypeError: Cannot read property 'data' of undefined

Currently, I am running Ubuntu 18.04 and if I run only Rscript test.R it works with no problem. Any help?

2
  • You may need to pass something to .data, like .data(0). Commented Apr 30, 2018 at 8:07
  • Were you able to solve the problem? I have the same issue running the example given with the package, both sync and async version give the same error. Commented Jun 27, 2018 at 0:42

2 Answers 2

0

I fix my similar issue with https://github.com/joshkatz/r-script/issues/19

If you still feeling lazy to pull the git, you can directly update the source code ./node_modules/r-script/index.js , then edit the function init as

function init(path) {
  var obj = new R(path);
  _.bindAll(obj, "data", "call", "callSync");
  return obj;
}

I hope you may find this helpful.

Sign up to request clarification or add additional context in comments.

Comments

0
 $ cd node_modules/r-script
 $ rm node_modules
 $ npm install [email protected]

in my case, downgrade underscore works

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.