2013-02-07 84 views
3

我一直在为我的计算机在家里的一个模拟项目工作R包,我已经使用RStudio来构建并成功安装它。然而另一台机器在我有麻烦......如果我尝试建立RStudio,这也将其安装过一个二进制大学,我得到一个错误,如果我只是编译源得到它的工作原理是.tar.gz ,但是当我来安装时,我再次得到错误。下面是两次出现错误的读数。我认为这是与库,但为什么这将是不同的,以我家里的电脑我不知道,我不是程序员,这台机器上安装完全相同的方式R和RTools和RStudio作为我个人机。 - 我有管理员访问了几天。R自定义软件包从文件错误安装

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 

回答

2

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

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

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

+0

它被连接到一个网络驱动器。谢谢!我会在早上第一时间尝试解决方案! – Ward9250

+0

我刚刚通过在R CMD BUILD INSTALL的-l选项下放置'\\ ueahome5/ressci17/yrq12edu/data/Documents/R/win-library/2.15 /'来尝试这种方法,并且也使用'U:/ ressci17/yrq12edu /数据/文档/ R /赢库/ 2.15 /'。可悲的是我把它说,它无法cd到第二个,因为它不存在,而第一个给了我一个问题,同以前的约lib.loc,也'\\ ueahome5/ressci17/yrq12edu /数据/文件/ R/win-library/2.15/00LOCK-speEaR/speEaR' – Ward9250

+0

@Axolotl9250,我想首先你应该将U:/ ressci17/yrq12edu/data/Documents/R/win-library/2.15 /'复制到你的Windows资源管理器中,请确保您可以访问该目录。如果它有效,那么也许你会尝试'devtools'包。我编辑了答案举个例子 – Zhenglei

0

我发现问题与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了惯用的蓝色。 enter image description here

因此,将反斜杠改为正斜杠,并且不会生成警告消息,并且所有roxygen注释现在都是蓝色。

#' 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