2013-02-07 83 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