Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

¿Cat() Call could be missing on Launch.R? at unexpected string in json at position 4 #14

Open
letrape opened this issue Nov 13, 2017 · 0 comments

Comments

@letrape
Copy link

letrape commented Nov 13, 2017

I've starting using this library for an android speed detection app wich requires to process the data with R.

I am exposing the result data trought an API, so the app can use the result.

Well first I have faced several problems to run my algorithm within Node.js some solutions was:

  1. install all libraries via Rscript inside the server console not vía needs (you must use install.package and specify a repo)

2)Check if Rscript is in the path and check if the lib folder for installing packages has write permissions in order to use Needs

  1. Install the latest Pull Requests, the master branch has some bugs, reviewing and installing the pull-request in this repo helped me a lot

Well finally I've get stucked on an error from node

ERROR:

unexpected string in json at position 4

It was because the return of the launch.R file was [1] "[35.636]" , where 35.363 is the result of my R algorithm.

I've tried with other results such as data frames and the result was the same [1] "[x1][x2]..."

The problem is that the double quotes are not a valid JSON format

then after hours of thinking, I've decided to call cat( ) function in the Launch.R file and all my problems gone

Replacing this line

do.call(toJSON, .e$out)

with:

output <- do.call(toJSON, .e$out)
cat(output)
My question is:

My workaround is correct? or Im missing something ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant