problems with plot.formula
As this happens in exactly the same way in 1.8.1 and 1.9.0, why are you blaming `recent changes in R 1.9.x'? I am baffled as to what you think is `recent'.
On Tue, 25 May 2004, Warnes, Gregory R wrote:
With the recent changes in R 1.9.x, it is now impossible to properly call plot on a formula() where the formula is provided via a named first argument. On today's R-1.9.1-alpha:
x <- 1:10 y <- rnorm(x,0.25) plot(x~y) plot(x=x~y)
Error in terms.formula(formula, data = data) : argument is not a valid model
plot(formula=x~y)
Error in plot(formula = x ~ y) : Argument "x" is missing, with no default
This occurs because plot.formula is no longer directly callable,
It is, via graphics:::plot.formula.
and the
first argument to plot.formula() is 'formula' while the first argument to
plot() is 'x'. Consequently one cannot properly pass a named first
argument since it will either fail for plot() or for plot.formula(). [I
suspect this is one reason why R CMD check complains about S3 methods that
don't match the call of the base method.]
This is much of a problem in interactive use, but it does cause problems in
functions, like my gregmisc::overplot(), which use the standard idiom
m <- match.call()
m[[1]] <- as.name('plot')
eval(m, parent.frame() )
Not a standard idiom for a generic with a formula method, and I think you really should be dispatching to the method here. [...]
Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595