2014-10-03 35 views
2

嗨,我正在關注Hilary的教程here和Hadley Wickham的here嘗試創建一個虛擬包。R devtools:文檔依賴項包不可用

然而,我的包需要一些外部依賴XMLRCurl在這種情況下,當我運行命令文件,它會抱怨說:

> setwd('/home/datafireball/projects/Rprojects/rgetout/rgetout') 
> document() 
Error: could not find function "document" 
> library(devtools) 
> document() 
Updating rgetout documentation 
Loading rgetout 
Loading required namespace: XML 
Error in (function (dep_name, dep_ver = NA, dep_compare = NA) : 
    Dependency package XML not available. 
> 

這是我DESCRIPTION文件。

Package: rgetout 
Title: A R package to get all the outlinks for a given URL 
Version: 0.1 
[email protected]: "Eric Cartman <[email protected]> [aut, cre]" 
Description: This package is intended to include as much web extraction functionality as much as  possible. It starts with one function. getout will extract 
all the outlinks for a given URL with a user-agent that you can customize. 
Depends: R (>= 3.0.2) 
Imports: 
    XML, 
    RCurl 
License: MIT 
LazyData: true 

這是source code github repo如果你想得到更多的信息。

+1

我推測你已經在你的系統上安裝了'XML'和'RCurl'.... – mnel 2014-10-03 03:22:19

+0

@mnel,實際上不是,我測試了代碼在我的windo上帶有XML和RCurl的ws box。然後我將代碼複製到我的ubuntu virtualbox中,預計它會按照說明安裝軟件包? – 2014-10-03 03:47:18

+0

在調用'document()'函數之前,您需要執行'library(devtools)'或'require(devtools)'。 – hrbrmstr 2014-10-03 03:49:00

回答

1

假設您在 這樣做時將擁有開發包所需的工具/依賴關係。

utils::install.packages具有依賴性的說法,這將嘗試安裝在其上包取決於/(在無論怎樣,他們都依賴卸載的軟件包(建議/取決於/ linkingTo)。

devtools::install_github將同樣執行。

安裝一個軟件包並將其記錄爲開發組件的部分是安靜的不同的活動 。