I've been working on a R package for a simulation project, on my computer at home I've used RStudio to build and install it successfully. However on another machine at university I'm having trouble... If I try and build a binary in RStudio, which also installs it too, I get an error, If I just compile a source to get a .tar.gz it works, but then when I come to install I get the error again. The readout with error that occurs both times, is below. I think it has something to do with libraries, but why this would be different to my home computer I would not know, I'm no programmer, and installed R and RTools and RStudio in exactly the same way on this machine as on my personal machine. - I have admin access for a few days.
install.packages("speEaR_1.0.tar.gz", repos=NULL, type="source")
Installing package(s) into ‘\\ueahome5/ressci17/yrq12edu/data/Documents/R/win-library/2.15’
(as ‘lib’ is unspecified)
* installing *source* package 'speEaR' ...
** R
** preparing package for lazy loading
** help
Warning: C:/Users/yrq12edu/AppData/Local/Temp/Rtmp84HJPx/R.INSTALL7e81a241d97/speEaR/man/makeSetMatrix.Rd:25: unknown macro '\begin'
Warning: C:/Users/yrq12edu/AppData/Local/Temp/Rtmp84HJPx/R.INSTALL7e81a241d97/speEaR/man/makeSetMatrix.Rd:26: unknown macro '\item'
Warning: C:/Users/yrq12edu/AppData/Local/Temp/Rtmp84HJPx/R.INSTALL7e81a241d97/speEaR/man/makeSetMatrix.Rd:30: unknown macro '\end'
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
no library trees found in 'lib.loc'
Error: loading failed
Execution halted
*** arch - x64
Warning in library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE) :
no library trees found in 'lib.loc'
Error: loading failed
Execution halted
ERROR: loading failed for 'i386', 'x64'
* removing '\\ueahome5/ressci17/yrq12edu/data/Documents/R/win-library/2.15/speEaR'
Warning messages:
1: running command 'C:/PROGRA~1/R/R-215~1.2/bin/i386/R CMD INSTALL -l "\\ueahome5/ressci17/yrq12edu/data/Documents/R/win-library/2.15" "speEaR_1.0.tar.gz"' had status 1
2: In install.packages("speEaR_1.0.tar.gz", repos = NULL, type = "source") :
installation of package ‘speEaR_1.0.tar.gz’ had non-zero exit status
I found the problem was related to the Windows path backslashes in the roxygen comments in the R script. The solution is to change the backslashes to a single forward slash. Example: originally my roxygen info was like this:
which results in this warning message:
The clue is that the text is orange instead of the usual blue in RStudio.
So change the backslash to a forward slash and no warning message is produced and all the roxygen comment is now blue.
I had encountered a similar error a few days ago. It is because you are installing to this directory:
I guess it is connected to a network drive. What you should do is go to that network drive and copy the address explicitly like
And then use it to specify the library location when you install. For example:
Or try devtools , unpack your tar ball and do something like:
This is how I solved my problem.