Re: [Rd] Problem with points/lines (PR#10472)

From: Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk>
Date: Thu, 29 Nov 2007 16:36:03 +0100

carlos_at_necsi.org wrote:
> Full_Name: Carlos Gershenson
> Version: 2.6.1
> OS: MacOSX
> Submission from: (NULL) (24.128.48.138)
>
>
> Hi,
>
> Try this out:
>
> x<-1:10
> y<-x/2
> plot(table(x))
> points(table(y))
> #or lines(table(y))
>
> No matter what's the value of y, it prints out in the coordinates of x... this
> happens only with tables, not with simple plot(x), points(y), and table(y) works
> fine
>
>
The real issue is that we have a plot method for tables, which tries to be smart about using numerical entry names. There's no similar points method, nor a lines method, so in those cases you get the default method, namely to plot the table values (all ones) against the *index*, i.e.,1:n. This shows the effect quite clearly:

plot(table(x^2)
lines(table(x))

(This is not a bug, since noone has promised you that lines and point methods should exist. It could be taken as an enhancement request.)
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)                  FAX: (+45) 35327907

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Thu 29 Nov 2007 - 15:40:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 29 Nov 2007 - 17:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.