【问题标题】:R custom package install from file errorR自定义包安装从文件错误
【发布时间】:2013-01-23 04:24:36
【问题描述】:

我一直在为一个模拟项目开发一个 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

【问题讨论】:

    标签: windows r installation package


    【解决方案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 ,解压你的 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/"')
    

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

    【讨论】:

    • 它连接到网络驱动器。谢谢!我会在早上第一件事尝试解决方案!
    • 我刚刚尝试过将\\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
    • @Axolotl9250 ,我认为首先您应该将U:/ressci17/yrq12edu/data/Documents/R/win-library/2.15/ 复制到您的Windows 资源管理器中,确保您可以访问该目录。如果它有效,那么也许你可以试试 devtools 包。我编辑了答案以举个例子
    【解决方案2】:

    我发现问题与 R 脚本中 roxygen cmets 中的 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多