[R定制包从文件错误安装(R custom package install from file er

2019-07-19 14:24发布

我一直工作在A 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

Answer 1:

我曾遇到类似的错误,前几天。 这是因为你安装到这个目录:

 '\\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,解开你的焦油球和做类似:

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/"')

这是我如何解决我的问题。



Answer 2:

我发现这个问题是关系到在R脚本roxygen评论Windows路径反斜杠。 解决的办法是反斜线更改为单斜杠。 例如:原来我roxygen信息是这样的:

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

导致此警告消息:

* 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)

线索是,该文本是橙色的,而不是在RStudio了惯用的蓝色。

所以反斜杠更改为正斜杠和任何警告消息产生,所有的roxygen评论现在是蓝色的。

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



文章来源: R custom package install from file error