[R] Date on x-axis of xyplot

Deepayan Sarkar deepayan at stat.wisc.edu
Thu Sep 18 04:13:16 CEST 2003


[Due to problems with my mail client, this message may
eventually reach the list twice. Sorry about that.]

On Wednesday 17 September 2003 08:51, David James wrote:
> Prof Brian Ripley wrote:
> > On Tue, 16 Sep 2003, Deepayan Sarkar wrote:
> > > Is the date class standard enough to warrant including a check for
> > > it in lattice ?
> >
> > I don't think so.  The POSIX*t classes in R are the most standard,
> > followed by the chron package and only then the date package.
>
> If it is not overly complicated to implement, could I timidly suggest
> *not* checking for specific classes inside lattice, but rather use
> some other kind of mechanism (perhaps invoking helper functions,
> or use specific methods, etc.) to render axes?

This is definitely a good idea generally, and lattice tries to do that as
much as possible (exceptions being splom, cloud, wireframe). However, at
some point the tick locations and labels need to be calculated by some
variation of pretty and format, which loses the class attribute and has to
be processed case by case.

In fact for POSIXct, pretty doesn't return sensible values, and that case
has to be handled completely separately. The base plot functions seem to
handle this via axis.POSIXct, which is not directly usable and so is
essentially repeated in lattice. It might be a good idea to eventually
separate the common part out as something similar to pretty.

I also just dicovered that POSIXct handling in lattice is broken, except
when scales$relation = "free" or "sliced". I'll fix this ASAP.

Deepayan




More information about the R-help mailing list