Rjsonio vs jsonlite lexical error - r

New to this so please excuse any mistakes.
I am using R to convert some JSON files and using JSONLITE is perfect in relation to the format that it produces. However I keep getting a lexical error similar to the below
Error in parse_con(txt, bigint_as_char) :
lexical error: invalid char in json text.
ed that it was delivered to "letterbox" but it wasn't\" ]\n
(right here) ------^
So I decided to use the JSONIO package and there is no lexical error with this package but the format is not as easy to work with.
So suppose I have two questions:
1: Does any one know why the error is produced using Jsonlite and not jsonio
2; is there an easy way to get jsonio to produce outputs like jsonlite?
Thanks
Ibrahim

Related

Unicode hyphen causes error when building R documentation

I'm trying to put together my first package for R, and I'm unable to generate the PDF for the documentation using R CMD Rd2pdf. The error I get is
! Package inputenc Error: Unicode char ‐ (U+2010)
(inputenc) not set up for use with LaTeX.
I don't really understand what's going on here, since it seems absurd that the hyphen symbol would naturally throw an error in building documentation for an R package. I'm using roxygen2 to build the package, and the main file is saved with UTF-8 encoding.

jsonlite::fromJSON is not working properly

I am trying to read in a JSON file (that I unfortunately cannot post here) into R using the fromJSON function from the jsonlite package.
Thereby, I always get a parsing error and I don't know why. The really strange thing is that I have two versions of the same file that appear absolutely the same to me in e.g. jsonformatter.org .
Does anyone know this error or how to track it? Is there another good way to read in JSON files into R?
Here is the error message:
Error in parse_con(txt, bigint_as_char) :
lexical error: invalid char in json text.
ÿþ{ (right here) ------^

Why do I get an error when loading the package tidyverse?

When I run library(tidyverse) I see a list of all the attached packages and below that there is an error message:
"Error in -library(tidyverse) : invalid argument to unary operator."
Why?
I am using the latest version of tidyverse (1.2.1).
Because you are not actually doing: library(tidyverse) but -library(tidyverse), note the hyphen (or minus sign) just before the call to library.
The call to library actually runs fine but then R tries to pass the returned value of library (a character vector with the list of attached packages) to the unary operator -, hence the error.
Just fix that typo, i.e. remove the -. :)

Getting an error in using particular "?" this operator,How to use it in swirl?

I am using swirl package for R programming. And for that, in a particular part I have to give this command which gives this error and that's why can't progress further.
?c
Error in shell.exec(url) :
file association for 'https://127.0.0.1:19202/library/base/html/c.html' is not available or invalid
Please help me to solve this problem, otherwise I am stuck here and can't get any progress.
Type below,It worked for me
info()
skip()

Error in reading SAS dataset in R 3.0.1

I am trying to read SAS dataset in R 3.0.1.
I have downloaded Hmisc package required to use sas.get function. But I am getting note as below:
Hmisc library by Frank E Harrell Jr
Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview')
to see overall documentation.
NOTE:Hmisc no longer redefines [.factor to drop unused levels when
subsetting. To get the old behavior of Hmisc type dropUnusedLevels().
Attaching package: ‘Hmisc’
Then I am using the following command:
sas.get(library = "C:\\SAS_dataset", member = "test", formats = FALSE, sasprog = sasprog)
Then the R goes in infinite loop and does not give output. Finally when i press "Esc", it terminates by giving an warning message saying
Warning message:
running command '"C:/program files/SAS/SAS 9.1/sas.exe" "C:\Users\TEJASW~1.ABH\AppData\Local\Temp\RtmpML87zC\SaS13c41642d38.3.sas" -log "_temp_.log"' had status 10708
I tried to find the reason for the same, but all in vain.
I don't understand the reason for this. Is it due to some note given by Hmisc package or something else?
Also I noted that I am facing this problem for latest version i.e. 3.0.1 only. Whereas I was able to read the SAS dataset with the same commands in version 2.15.1.
Can any one help me to solve this problem.
Thanks in advance.
Regards,
Tejasweeni
If you have SAS, you can always export your data to a CSV file and read in R using read.table() or read.csv(). I think this is often the best solution.

Resources