R imports everything but a few functions

I am working on upgrading to ggtern to handle ggplot 2.0.X, I need to import the grid package, however ggplot2 now exports arrow and unit , which generate warnings when loading my package:

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

Is it possible to import a library, with the exception of a few functions, that is, something like the effect of the following can be useful in roxygen:

 #' @importAllExcept grid arrow unit 

which should have the same effect as the following (minus import arrow and unit ):

 #' @import grid 

Any suggestions?

+5
source share
1 answer

Currently my best idea

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

This is clearly not a good solution, but unlike export, you cannot use a regular expression to import, i.e. no importPatternFrom .

+2
source

Source: https://habr.com/ru/post/1240599/


All Articles