search for: hookfun

Displaying 1 result from an estimated 1 matches for "hookfun".

Did you mean: hookfunc
2011 Aug 08
1
Overwriting imported function in another package
...low shows the fix which works for ggplot (because it depends on grid), but it doesn't work for lattice, because it imports grid. Is there any way to overwrite grid.newpage for all instantiations of it? #packages library(grid); library(lattice); library(ggplot2); #create the modified function. hookfun <- deparse(body(plot.new))[1:6] oldfun <- deparse(body(grid::grid.newpage))[-1]; newfun <- grid::grid.newpage; body(newfun) <- parse(text=c(hookfun, oldfun)); #overwrite it in the package unlockBinding("grid.newpage", as.environment("package:grid")) assign("gri...