是否需要从基础包中显式导入 roxygen?
Are explicit roxygen import from base package needed?
具体例子:
在我的包中,我的一个函数使用 grep
形式的 base
包。
我应该显式导入 grep
还是只会引入无用的依赖项?我的意思是,每个人都已经有了 base
包,对吧?
为了便于说明:
#' Group_by with regex based column selection
#' Similar to `group_by` but grouping columns are selected with a regex.
#' @importFrom dplyr group_by
#' @importFrom base grep
#' @export
group_at <- function(df, pattern)
group_by_(df, .dots=grep(names(df), pattern=pattern, value=T))
来自编写 R 扩展 手册 sec.1.1.3:
It makes no sense to declare a dependence on R without a version specification, nor on the package base: this is an R package and package base is always available.
从 NAMESPACE
中删除与程序包 base
关联的以下术语
import(base) ,
importFrom(base,system.file)
并在 DESCRIPTION 文件中,删除以下术语。
Imports: base
然后下面的错误就消失了:
preparing package for lazy loading
Error in asNamespace(ns, base.OK = FALSE) :
operation not allowed on base namespace
ERROR: lazy loading failed for package 'aa'
具体例子:
在我的包中,我的一个函数使用 grep
形式的 base
包。
我应该显式导入 grep
还是只会引入无用的依赖项?我的意思是,每个人都已经有了 base
包,对吧?
为了便于说明:
#' Group_by with regex based column selection
#' Similar to `group_by` but grouping columns are selected with a regex.
#' @importFrom dplyr group_by
#' @importFrom base grep
#' @export
group_at <- function(df, pattern)
group_by_(df, .dots=grep(names(df), pattern=pattern, value=T))
来自编写 R 扩展 手册 sec.1.1.3:
It makes no sense to declare a dependence on R without a version specification, nor on the package base: this is an R package and package base is always available.
从 NAMESPACE
中删除与程序包base
关联的以下术语
import(base) ,
importFrom(base,system.file)
并在 DESCRIPTION 文件中,删除以下术语。
Imports: base
然后下面的错误就消失了:
preparing package for lazy loading
Error in asNamespace(ns, base.OK = FALSE) :
operation not allowed on base namespace
ERROR: lazy loading failed for package 'aa'