[R-pkg-devel] Redefinition of generic for plot function breaks plot.formula

Benjamin Hofner benjamin.hofner at fau.de
Mon Aug 31 12:03:00 CEST 2015


Dear all,

CRAN policies do not allow that single methods (for generic functions) 
which are defined in base or recommended packages are replaced. They 
advice package authors to replace the standard generic and use a 
xxx.default method which then calls the original standard generic.

Using the following code


## overwrite standard generic
plot <- function(x, y, ...)
     UseMethod("plot")

## per default fall back to standard generic
plot.default <- function(x, y, ...)
     graphics::plot(x, y, ...)

## now specify modified plot function for data frames
plot.data.frame <- function(x, variables = names(x), ...)


essentially works for all tested plot.xxx functions. Yet, it breaks 
plot.formula. How can I proceed to overwrite plot.data.frame without 
breaking plot.formula. Any help is greatly appreciated.

For a detailed description of the problem with syntax highlighting and 
code to reproduce the problem please see:

http://stackoverflow.com/questions/32246361/redefinition-of-generic-for-plot-function-breaks-plot-formula

Best,
Benjamin
-- 
******************************************************************************
Dr. rer. nat. Benjamin Hofner

Institut für Medizininformatik, Biometrie und Epidemiologie
Friedrich-Alexander-Universität Erlangen-Nürnberg
Waldstr. 6 - 91054 Erlangen - Germany

Tel: +49-9131-85-22707
Fax: +49-9131-85-25740

Büro:
   Raum 3.036
   Universitätsstraße 22
   (Eingang linke Seite des Gebäudes; Wegweiser IMBE)

benjamin.hofner at fau.de

http://www.imbe.med.uni-erlangen.de/cms/benjamin_hofner.html
http://www.benjaminhofner.de



More information about the R-package-devel mailing list