I'm not sure exactly where to point my finger with this one, but there
is a nasty surprise to the unsuspecting user.
There is no check on the length of the vector passed in the pchargument to plot,
it is just recycled as necessary:
plot(1:10,1:10,pch=1:2)
gives alternating circles and triangles.
The nasty bits come up especially with plot.formula:
x<-1:10;y<-1:10
plot(y~x,subset=x%%2==1,pch=x%%2)
- and the plotting symbols are *not* all the same. Even more
pernicious, if missing values are involved:
> y[x%%2==1]<-NA
> plot(y~x,pch=x%%2)
gives you the wrong symbols (in practice, this messes up things like
plot(height~age,pch=sex) rather badly!).
It would help to get a warning that the lengths don't match, but are
there any good uses of the recycling of pch?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._