I am a newbie in R, and I am trying to build an R package but I keep getting an unexpected input error when I try using the build, check or install commands. I used the following command to generate the skeleton: package.skeleton("test") After this I went to the command prompt and to the directory with the test folder and ran the command: R CMD build test I got the following error message: Error: 37:1: unexpected input 37: ^ I even tried the check and INSTALL commands on the package and got the same error. I tried googling the error code and the error message but it seems like I should not be getting such an error while building the package itself. Everywhere I checked it seemed like simply typing that command in command prompt should work. I am wondering if anyone knows what I am doing wrong? Thanks for the help. I am using R 2.15.0 on Windows 7. -- View this message in context: http://r.789695.n4.nabble.com/Unexpected-input-while-building-package-in-R-tp4618065.html Sent from the R help mailing list archive at Nabble.com.
R. Michael Weylandt
2012-May-08 21:11 UTC
[R] Unexpected input while building package in R
Can you show us the file that's throwing an error? This suggests there's something syntactically invalid in your code, but it's impossible to say what without seeing it. Best, Michael On Tue, May 8, 2012 at 1:00 PM, abhisarihan <abhisarihan at gmail.com> wrote:> I am a newbie in R, and I am trying to build an R package but I keep getting > an unexpected input error when I try using the build, check or install > commands. I used the following command to generate the skeleton: > > package.skeleton("test") > After this I went to the command prompt and to the directory with the test > folder and ran the command: > > R CMD build test > I got the following error message: > > Error: 37:1: unexpected input > 37: > ? ? ^ > I even tried the check and INSTALL commands on the package and got the same > error. I tried googling the error code and the error message but it seems > like I should not be getting such an error while building the package > itself. Everywhere I checked it seemed like simply typing that command in > command prompt should work. I am wondering if anyone knows what I am doing > wrong? Thanks for the help. > > I am using R 2.15.0 on Windows 7. > > -- > View this message in context: http://r.789695.n4.nabble.com/Unexpected-input-while-building-package-in-R-tp4618065.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.
You did not specify any object in the function. Thus R is building the package "test" with all the objects present in your session when you are calling the package.skeleton function. I suppose that one of these objects is causing problem. I suggest you list all the variables/function necessary for your package in the function. Something like that : a <- 1 b <- function(x) {x+x} package.skeleton(name = "test", list=c("a","b")) Eloi On 12-05-08 10:00 AM, abhisarihan wrote:> I am a newbie in R, and I am trying to build an R package but I keep getting > an unexpected input error when I try using the build, check or install > commands. I used the following command to generate the skeleton: > > package.skeleton("test") > After this I went to the command prompt and to the directory with the test > folder and ran the command: > > R CMD build test > I got the following error message: > > Error: 37:1: unexpected input > 37: > ^ > I even tried the check and INSTALL commands on the package and got the same > error. I tried googling the error code and the error message but it seems > like I should not be getting such an error while building the package > itself. Everywhere I checked it seemed like simply typing that command in > command prompt should work. I am wondering if anyone knows what I am doing > wrong? Thanks for the help. > > I am using R 2.15.0 on Windows 7. > > -- > View this message in context: http://r.789695.n4.nabble.com/Unexpected-input-while-building-package-in-R-tp4618065.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Eloi Mercier Bioinformatics PhD Student, UBC Paul Pavlidis Lab 2185 East Mall University of British Columbia Vancouver BC V6T1Z4
I just fixed the issue. I had to do a full re-install of R to get it working. I had initially re-installed Rtools and Perl which did not work. However, upon re-installing R, the error seemed to go away. So I do not really know what corrupted the R install from earlier, but at the moment, I seemed to have it working. Is there any way that the registry can be corrupted? Perhaps, I inadvertently managed to do that. -- View this message in context: http://r.789695.n4.nabble.com/Unexpected-input-while-building-package-in-R-tp4618065p4618755.html Sent from the R help mailing list archive at Nabble.com.