[R] dates with lattice graphics

Gabor Grothendieck ggrothendieck at gmail.com
Mon Sep 14 22:47:43 CEST 2009


See last line to every message on r-help which in particular
asks for reproducible code and in this case means include
date and count.  Note ?dput

This work for me:

library(lattice)
tt <- as.POSIXct(Sys.Date() + 1:10)
y <- seq_along(tt)
xyplot(y ~ tt)

as does this:

library(zoo)
xyplot(zoo(cbind(y, y, y), tt))


On Mon, Sep 14, 2009 at 4:41 PM, Larry White <ljw1001 at gmail.com> wrote:
> Hi,
> I'm trying to do something simple (I think) with lattice graphics.  I want
> to have three xyplots in a single column, where the x axis for the three is
> a date range and the y axes are numeric.
>
> I tried doing the first chart, and ran into a problem.  When I enter:
>
> xyplot (date ~ count)
>
> I get a well formed plot with the date on the y axis, but when I enter:
>
> xyplot (count ~ date)
>
> I get: "Error in as.POSIXct.default(X[[2L]], ...) :
>  do not know how to convert 'X[[2L]]' to class "POSIXlt"
>
> Is there a way to create an xyplot with the dates on the x axis?
>
> Thank you.
>
> Larry
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list