我正在使用 setRefClass
创建类,因为它是 methods
的一部分包,我假设您需要将此依赖项声明为 import
.
但是,以下最小示例失败 Rcmd.exe check
当import
ing 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
为 methods
所以保持隐藏包对 methods
的依赖.我的解释是否正确,如果正确,为什么要隐藏对 methods
的依赖?我的设置:
最佳答案
经过更多的搜索,我意识到我匆忙忘记添加 Imports: methods
到我的 DESCRIPTION
文件。
关于R 包 - 我应该导入 `methods` 包吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21549536/