joshkatz / r-script

A simple little module for passing data from NodeJS to R (and back again).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: No method asJSON S3 class: histogram

opened this issue · comments

I am trying to call simple R file which will call hist function.
But when I call this function, I am getting following error

Error: No method asJSON S3 class: histogram

Execution halted

below is my R code

x <- c(1,2,3,4,5,6,6)

hist(x, col="lightblue")

and here is my index.js file


var express = require('express');
var R = require("r-script");

var app = express(); app.get('/', function (req, res) 
{      
	var out = R("example/sample.R")
  .data("hello world", 20)
  .callSync();
    console.log(out);

}) 
var server = app.listen(8081, function () {      var port = server.address().port   
   console.log(`Example app listening at http://localhost:${port}`)})

Similarly I cannot execute any other R function. example
x <- c(1,2,3,4,5,6,6) print(summary(x));

I am getting error as below

Error: No method asJSON S3 class: table

Execution halted