Installing custom R package from file error

I am working on an R package for a simulation project, on my computer at home I used RStudio to build and install it. However, on a different machine at the university, I have problems ... If I try to build a binary in RStudio, which also installs it too, I get an error. If I just compile the source to get the .tar.gz it works, but then when I come to install I get the error again. An error reading that occurs simultaneously is shown below. I think it has something to do with libraries, but why it will be different from my home computer, I would not know, I am not a programmer, and installed R and RTools and RStudio exactly the same on this computer as on my personal a machine. - I have admin access for several 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

      

+3


source to share


2 answers


I ran into a similar error a few days ago. This is because you install in this directory:

 '\\ueahome5/ressci17/yrq12edu/data/Documents/R/win-library/2.15/speEaR'

      

I am assuming it is mapped to a network drive. What you need to do is navigate to that network drive and copy an address that clearly looks like

 'M:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/'

      

And then use it to specify the location of the library when installing. For example:



install.packages("speEaR_1.0.tar.gz", repos=NULL, type="source",lib='U:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/')

      

Or try devtools , unzip your tar ball and do something like:

library(devtools)
has_devel() ## check if your Rtools are properly installed
check('speEaR')
##build('speEaR')
install("speEaR",args='-l "U:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/"')

      

This is how I solved my problem.

+2


source


I found the problem was with Windows backslashes in the roxygen comments in the R script. The solution is to change the backslash to a single forward slash. Example: originally my roxygen info was like this:

#'  Performs a search in MS Windows file system for all files in the
#'  `C:\USERS\MYNAME` directory, and all directories below that

      

which leads to this warning message:

* installing to library 'C:/Users/MYNAME/Documents/R/win-library/3.2'
* installing *source* package 'whatever' ...
** R
** preparing package for lazy loading
** help
Warning: C:/Users/MYNAME/Documents/R/CODE/whatever/man/func.Rd:11: unknown macro '\USERS'
Warning: C:/Users/MYNAME/Documents/R/CODE/whatever/man/func.Rd:11: unknown macro '\MYNAME'
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (whatever)

      



The hint is that the text is instead orange instead of the usual blue in RStudio. enter image description here

So, change the backslash to a forward slash and no warning message will appear and all roxygen comments are now blue.

#'  Performs a search in MS Windows file system for all files in the
#'  `C:/USERS/MYNAME` directory, and all directories below

      

enter image description here

0


source







All Articles