R包 - 我应该导入`methods`包吗?

时间:2014-02-04 10:15:14

标签: r methods package reference-class

我正在使用setRefClass创建类,因为它是methods包的一部分,我认为您需要将此依赖项声明为import

但是,Rcmd.exe check import时,以下最小示例失败methods

#' @docType package
#' @import methods
A <- setRefClass("A")

出现以下错误(我的包名为Test):

==> Rcmd.exe check Test_1.0.tar.gz

<Lots of checks here...>

* checking package dependencies ... ERROR
Namespace dependency not required: 'methods'

See the information on DESCRIPTION files in the chapter 'Creating R
packages' of the 'Writing R Extensions' manual.

Exited with status 1.

因此,根据我的结论,似乎我被告知要删除import的{​​{1}},因此请隐藏包对methods的依赖关系。我的解释是否正确,如果是,为什么要隐藏对methods的依赖?

我的设置:

  • Roxygen2 3.0.0
  • R:3.0.2(飞盘航行)
  • IDE:RStudio 0.98.490
  • 操作系统:Windows 8.1

1 个答案:

答案 0 :(得分:4)

经过更多的狩猎后,我意识到我急忙忘记将Imports: methods添加到我的DESCRIPTION文件中。

相关问题