[Rd] Problem with points/lines (PR#10472)
Peter Dalgaard
P.Dalgaard at biostat.ku.dk
Thu Nov 29 16:36:03 CET 2007
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
More information about the R-devel
mailing list