嗨,我正在学习教程 here来自希拉里和 here来自 Hadley Wickham 试图创建一个虚拟包。
但是,我的包需要一些外部依赖项 XML
和 RCurl
在这种情况下,当我运行命令文档时,它会提示:
> 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
Authors@R: "Eric Cartman <Eric.Cartman@gmail.com> [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如果您想获得更多信息。
请您参考如下方法:
如果您遇到此问题,即使您已经安装并加载了软件包,我建议您执行以下操作。
Imports:
和 Suggests:
您的 DESCRIPTION
的条目文件。 library(usethis)
确保您已使用此功能DESCRIPTION
文件,通过在您的控制台上运行以下命令:usethis::use_package("dplyr")
对于任何 Imports:
你需要。对每个需要的库重复此步骤。 就我而言,
dplyr
是拒绝加载的那个。您可以通过执行以下操作来决定包的位置:
usethis::use_package("dplyr", "Suggests")
.