[R] error in color-labeling in plot.lm

Prof Brian D Ripley ripley at stats.ox.ac.uk
Mon May 8 10:33:32 CEST 2006

On Mon, 8 May 2006, Ulrich Halekoh wrote:

> I want to label groups of points in
> the plot of residuals against predicted values
> generated by plot.lm().
> Labelling the points by color
> x<-1:15
> y<-rnorm(15)
> f<-factor(rep(c(1:3),each=5))
> g<-glm(y~x)
> plot(g,which=1,col=c(1,2,3)[f])
> I receive the error message
> Error in title(main, sub, xlab, ylab, line, outer, ...) :
>        graphical parameter "col" has the wrong length
> How can I resolve the error?

Well, the help does say

      ...: other parameters to be passed through to plotting functions.

and it really is unclear what you intended 'col' to refer to.  But as 
title() is not going to make use of it, it should accept it.  I'll see if I 
can adapt it suitably.

Brian D. Ripley,                  ripley at 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

More information about the R-help mailing list