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?
 
 
 
Labelling by symbols works fine
 
plot(g,which=1,pch=c(1,2,3)[f])
 
And setting
 
par(mfrow=c(1,2))
 
before plotting, produces  the color plot without error
 
plot(g,which=1,col=c(1,2,3)[f])
 
 
 
Ulrich
 
platform       i386-pc-mingw32           
arch           i386                      
os             mingw32                   
system         i386, mingw32             
status                                   
major          2                         
minor          3.0                       
year           2006                      
month          04                        
day            24                        
svn rev        37909                     
language       R                         
version.string Version 2.3.0 (2006-04-24)


Ulrich Halekoh
Danish Institute of Agricultural Sciences
Unit of Statistics and Decision Analysis
8830 Tjele, Denmark
 

	[[alternative HTML version deleted]]


