我一直在为模拟项目开发R包,在家里的电脑上,我已经使用RStudio来成功构建和安装它。但是在大学的另一台机器上,我遇到了麻烦...如果我尝试在RStudio中构建二进制文件(也同样安装了它),则会收到错误消息;如果我只是编译源代码以获取.tar.gz,则它会起作用,但是当我开始安装时,再次出现错误。两次均发生错误的读数如下。我认为这与库有关,但是为什么这与我的家用计算机有所不同,我也不知道,我不是程序员,所以在这台计算机上安装R和RTools和RStudio的方式与我个人上的安装方式完全相同机器。 -我有几天的管理员权限。

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

最佳答案

几天前,我遇到了类似的错误。这是因为您要安装到以下目录:

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

我猜它已连接到网络驱动器。您应该做的是转到该网络驱动器,然后像这样明确复制地址
 'M:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/'

然后在安装时使用它来指定库的位置。例如:
install.packages("speEaR_1.0.tar.gz", repos=NULL, type="source",lib='U:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/')

或尝试使用 devtools ,打开tar球的包装,然后执行以下操作:
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/"')

这就是我解决问题的方式。

09-09 20:08
查看更多