Timothy W. Cook
2014-May-18 16:54 UTC
[R] unable to collate and parse R files for package -- unexpected end of input
This is the error I get attempting to build and install a package I wrote. I am using R Studio (but I did try with R CMDs as well). The file that is blamed in the error is the last file alphabetically. If I remove that file. I get the same error on the remaining last file alphabetically. So my guess is that it isn't actually one of these files. However, I have no clue how to troubleshoot this problem. I am quite new to R. I built a generator to create this R pkg. But it is based on a very similar one that works okay that I built by hand. They are available in their entirety on GitHub at: https://github.com/mlhim/R_test_prj The one that works is: ccdTest244AllDatatypes299a8123d9f7 The one that doesn't work is: ccdTest244AllDatatypesa5c7aca0036f The 00install.out file isn't particularly enlightening: ----------------------------------------------------------------------------- * installing *source* package ccdTest244AllDatatypesa5c7aca0036f ... ** R Error in parse(outFile) : /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0: unexpected end of input 41: return(' http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd') 42: } ^ ERROR: unable to collate and parse R files for package ccdTest244AllDatatypesa5c7aca0036f * removing /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f * installing *source* package ccdTest244AllDatatypesa5c7aca0036f ... ** R Error in parse(outFile) : /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0: unexpected end of input 41: return(' http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd') 42: } ^ ERROR: unable to collate and parse R files for package ccdTest244AllDatatypesa5c7aca0036f * removing /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f ------------------------------------------------------------- Any help is greatly appreciated. This is part of a large open source effort in healthcare interoperability and data analysis. Thanks In Advance, Tim ===========================================Timothy Cook LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook MLHIM http://www.mlhim.org [[alternative HTML version deleted]]
Duncan Murdoch
2014-May-18 20:24 UTC
[R] unable to collate and parse R files for package -- unexpected end of input
On 18/05/2014, 12:54 PM, Timothy W. Cook wrote:> This is the error I get attempting to build and install a package I wrote. > > I am using R Studio (but I did try with R CMDs as well). > > The file that is blamed in the error is the last file alphabetically. If I > remove that file. I get the same error on the remaining last file > alphabetically. So my guess is that it isn't actually one of these files. > However, I have no clue how to troubleshoot this problem. I am quite new > to R.This indicates that you open a block using "{" (or perhaps "[" or "("), but never close it. Unfortunately the parser doesn't tell you where the opening brace was. A quick way to locate which file is to parse your source files one at a time; e.g. for (f in list.files("somedir/R", full.names=TRUE)) parse(f) This will get an error on the first file with unmatched braces. It won't tell you where to look in that file, but it's usually not too hard to find that by looking. There are ways to find the spot automatically, but they're not trivial: see the discussion of partial parse results in ?parse, and fill in a bunch of blanks. Here without much explanation is an example. f <- "some file with unbalanced braces" text <- readLines(f) src <- srcfile(text) parse(text=text, srcfile=src) # Generates error d <- getParseData(src) d[d$token == "'{'" && d$parent == 0,] This will print something like line1 col1 line2 col2 id parent token terminal text 217 37 3 37 3 217 0 '{' TRUE { telling you that the brace on line 37 was never matched. If you don't find anything, try other kinds of parens or brackets, though they are less likely. Duncan Murdoch> > I built a generator to create this R pkg. But it is based on a very > similar one that works okay that I built by hand. > > They are available in their entirety on GitHub at: > https://github.com/mlhim/R_test_prj > > The one that works is: ccdTest244AllDatatypes299a8123d9f7 > > The one that doesn't work is: ccdTest244AllDatatypesa5c7aca0036f > > The 00install.out file isn't particularly enlightening: > ----------------------------------------------------------------------------- > * installing *source* package ???ccdTest244AllDatatypesa5c7aca0036f??? ... > ** R > Error in parse(outFile) : > > /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0: > unexpected end of input > 41: return(' > http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd') > 42: } > ^ > ERROR: unable to collate and parse R files for package > ???ccdTest244AllDatatypesa5c7aca0036f??? > * removing > ???/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f??? > > > > * installing *source* package ???ccdTest244AllDatatypesa5c7aca0036f??? ... > ** R > Error in parse(outFile) : > > /home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/00_pkg_src/ccdTest244AllDatatypesa5c7aca0036f/R/meta:43:0: > unexpected end of input > 41: return(' > http://www.ccdgen.com/ccdlib/ccd-31598ac4-eac4-4f45-928e-a5c7aca0036f.xsd') > 42: } > ^ > ERROR: unable to collate and parse R files for package > ???ccdTest244AllDatatypesa5c7aca0036f??? > * removing > ???/home/tim/MLHIM/git/R_test_prj/ccdTest244AllDatatypesa5c7aca0036f.Rcheck/ccdTest244AllDatatypesa5c7aca0036f??? > ------------------------------------------------------------- > > Any help is greatly appreciated. > > This is part of a large open source effort in healthcare interoperability > and data analysis. > > Thanks In Advance, > Tim > > > ===========================================> Timothy Cook > LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook > MLHIM http://www.mlhim.org > > [[alternative HTML version deleted]] > > > > ______________________________________________ > R-help at r-project.org mailing list > 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. >