我setRefClass用来创建类,因为它是methods包的一部分,所以我假设你需要将此依赖项声明为import.
但是,以下最小示例Rcmd.exe check在importing时失败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.
因此,据我所知,似乎有人告诉我删除importformethods并隐藏包对methods. 我的解释是否正确,如果是,为什么要隐藏对 的依赖methods?
我的设置:
- 氧气2 3.0.0
- R:3.0.2(飞盘航行)
- IDE:RStudio 0.98.490
- 操作系统:Windows 8.1