R导入除几个函数外的所有函数

R import all but a couple of functions

我正在升级到 ggtern 以处理 ggplot 2。0.X,我需要导入网格包,但是,ggplot2 现在正在导出 arrowunit 函数,它在加载我的包时生成警告:

Warning messages:
1: replacing previous import by ‘grid::arrow’ when loading ‘ggtern’ 
2: replacing previous import by ‘grid::unit’ when loading ‘ggtern’ 

是否可以导入除了几个函数之外的库,即具有以下效果的东西可能在 roxygen 中有用:

#' @importAllExcept grid arrow unit

这应该与以下具有相同的效果,(减去导入 arrowunit):

#' @import grid

有什么建议吗?

目前我最好的想法是

all <- getNamespaceExports("grid")
paste("@importFrom grid", paste(all[!(all %in% c("arrow", "unit"))], collapse = " ")) 
#[1] "@importFrom grid grid.edit pop.viewport ...

这显然不是一个好的解决方案,但与导出不同,您不能对导入使用正则表达式,即没有 importPatternFrom.