【发布时间】:2016-11-30 10:57:02
【问题描述】:
具体例子:
在我的包中,我的一个函数使用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))
【问题讨论】:
-
如果您需要导入
grep,则需要导入所有内容,甚至包括function和(,它们也存在于base 中。这很快就会变得乏味。