[英]R packages - should I import the `methods` package?
I'm using setRefClass
to create classes and since is part of the methods
package, I presumed you need to declare this dependency as an import
. 我正在使用
setRefClass
来创建类,因为它是methods
包的一部分,我假设您需要将此依赖项声明为import
。
However, the following minimal example fails Rcmd.exe check
when import
ing methods
: 但是,
import
methods
时,以下最小示例无法Rcmd.exe check
:
#' @docType package
#' @import methods
A <- setRefClass("A")
with the following error (my package is called Test
): 出现以下错误(我的包名为
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.
So from what I can make out, it appears I'm being told to remove the import
for methods
and so keep hidden the package's dependency on methods
. 所以从我可以看出,似乎我被告知删除
methods
的import
,因此保持隐藏包对methods
的依赖。 Is my interpretation correct and if so, why hide the dependency on methods
? 我的解释是否正确,如果是,为什么要隐藏对
methods
的依赖?
My setup: 我的设置:
经过更多的狩猎,我意识到,在我的匆忙中,我忘了在我的DESCRIPTION
文件中添加Imports: methods
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.