Skip to content

Cannot read property 'data' of undefined and outdated ex-async.R #27

Open
@johnlin89

Description

@johnlin89

I ran npm install r-script in Users//Documents/workspace-neon/mss-server/ and was testing the example R scripts and javascripts. Specifically example.js with ex-sync.R.

My path was /Users//Documents/workspace-neon/mss-server/node_modules/r-script/example/ and I ran:
node ex.js

I kept getting

    at Object.<anonymous> (/Users/linjo/Documents/workspace-neon/mss-server/node_modules/r-script/example/ex.js:6:3)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

I believe the fix is documented in https://stackoverflow.com/questions/50093298/r-integration-with-node-script-using-r-script

In index.js, the init function should be:

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

Also, in ex-async.R you need to change summarize_each to summarize_all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions