node-r-runner
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

node-r-runner

Experimental

Node.js module for running R scripts

Installation

R needs to already be installed, and jsonlite R library needs to be installed.

yarn add node-r-runner or npm install node-r-runner

Usage

In an R file:

input[[1]] + input[[2]]

In node:

const { R } = require('node-r-runner')

let r = new R('./add.R')

// optionally pass an options object used in child_process spawn calls
let r = new R('./add.R', {env: {PATH: '/bin:/location/to/R/bin'}})

// data is converted to a list variable `input` in the R script
r.data(2, 3)

// call the script async
r.call()
  .then(response => response === 5) // true
  .catch(e => console.log('error : ', e))

// OR call the script async

let result = r.callSync() // could raise an exception
result === 5 // true

Readme

Keywords

none

Package Sidebar

Install

npm i node-r-runner

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

7.76 kB

Total Files

6

Last publish

Collaborators

  • saiemgilani