[Rd] coplot using Date object (PR#8147)

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Sep 20 23:10:39 CEST 2005


On Tue, 20 Sep 2005 mwtoews at sfu.ca wrote:

> Full_Name: Michael Toews
> Version: 2.1.1
> OS: WinXP (SP2)
> Submission from: (NULL) (142.58.206.114)
>
>
> This is a simple feature request concerning the display of the axis in the
> coplot function.
> Consider an arbritrary set of values from 1990-1999:
>
> date <- as.Date(paste(rep(1990:1999,each=365),1:365),"%Y %j")
> mon <- factor(months(date,T),levels=month.abb)
> value <- runif(3650)
>
> # Now create coplot for each month:
> coplot(value ~ date | mon)
>
> # The resulting date on the x-axis is not like the axis produced from:
> plot(value ~ date)

Why do you expect it to be?  plot() is generic, and coplot() is not: 
plot(value ~ date) is just a round-the-houses way to generate the call 
plot(date, value) (and that is why it happens to work with Date objects).

Think of coplot() as a limited predecessor of lattice graphics, which also 
precedes class "Date".  Lattice currently handles POSIXct date-times, and 
it would be nice if it handled Date too.

-- 
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-devel mailing list