search for: oldfun

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

Did you mean: oldfunc
2011 Aug 08
1
Overwriting imported function in another package
...ecause 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("grid.newpage", newfun, pos="package...