我一直在为一个仿真项目开发一个 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/
作为R CMD BUILD INSTALL命令的-l选项,还有U:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/
。可惜第二个路径无法进行cd操作,因为它不存在。而第一个路径给我带来了一个与之前关于lib.loc的问题相同的问题,同时还涉及到了\\ueahome5/ressci17/yrq12edu/data/Documents/R/win-library/2.15/00LOCK-speEaR/speEaR
。 - SJWardU:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/
复制到你的Windows资源管理器中,确保你可以访问该目录。如果可以访问,那么你可以尝试使用devtools
包。我编辑了答案并给出了一个例子。 - Zhenglei