Hi All, I downloaded a data file from dropbox and its in JSON format. here is my code: library(RJSONIO) data <- fromJSON(file='C:/Users/Downloads/sample.json') Lines <- readLines("C:/Users/Downloads/sample.json") df <- as.data.frame(t(sapply(Lines, fromJSON))) I got this error message: incomplete final line found on 'C:/Users/Downloads/sample.json' The file path is def correct, can anyone help me on this? Thanks! [[alternative HTML version deleted]]
Hi Ye Lin, Looks like the file was read, but there is no linefeed at the end of the last line. You could probably stick one in using a text or hex editor and you won't get the warning. Jim On Sun, Jun 7, 2015 at 3:50 PM, Ye Lin <yelin at lbl.gov> wrote:> Hi All, > > I downloaded a data file from dropbox and its in JSON format. > > here is my code: > library(RJSONIO) > data <- fromJSON(file='C:/Users/Downloads/sample.json') > Lines <- readLines("C:/Users/Downloads/sample.json") > df <- as.data.frame(t(sapply(Lines, fromJSON))) > > I got this error message: > incomplete final line found on 'C:/Users/Downloads/sample.json' > > The file path is def correct, can anyone help me on this? > > Thanks! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
> On 07-06-2015, at 07:50, Ye Lin <yelin at lbl.gov> wrote: > > Hi All, > > I downloaded a data file from dropbox and its in JSON format. > > here is my code: > library(RJSONIO) > data <- fromJSON(file='C:/Users/Downloads/sample.json') > Lines <- readLines("C:/Users/Downloads/sample.json") > df <- as.data.frame(t(sapply(Lines, fromJSON))) > > I got this error message: > incomplete final line found on 'C:/Users/Downloads/sample.json? >It?s a warning NOT an error message. And it?s perfectly clear. See here in the archives of R-help: https://stat.ethz.ch/pipermail/r-help/2011-December/298216.html Take Lim Lemon?s advice: use a plain text editor , goto the last line in the file, goto to the end of the line and then press <Return> or <Enter> Berend> The file path is def correct, can anyone help me on this? > > Thanks! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
On 07/06/2015 08:10, Berend Hasselman wrote:> >> On 07-06-2015, at 07:50, Ye Lin <yelin at lbl.gov> wrote: >> >> Hi All, >> >> I downloaded a data file from dropbox and its in JSON format. >> >> here is my code: >> library(RJSONIO) >> data <- fromJSON(file='C:/Users/Downloads/sample.json') >> Lines <- readLines("C:/Users/Downloads/sample.json") >> df <- as.data.frame(t(sapply(Lines, fromJSON))) >> >> I got this error message: >> incomplete final line found on 'C:/Users/Downloads/sample.json? >> > > It?s a warning NOT an error message. And it?s perfectly clear. > > See here in the archives of R-help: https://stat.ethz.ch/pipermail/r-help/2011-December/298216.html > > Take Lim Lemon?s advice: use a plain text editor , goto the last line in the file, goto to the end of the line and then press <Return> or <Enter>Or read the help (especially when replying): warn: logical. Warn if a text file is missing a final EOL or if there are embedded nuls in the file. If you know the file is not a normal text file, use warn = FALSE. -- Brian D. Ripley, ripley at stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford 1 South Parks Road, Oxford OX1 3TG, UK