Re: [R] Inconsistent lattice scales$x$at, label behaviour for POSIXct

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Tue, 5 Feb 2008 12:59:36 -0800

On 2/5/08, Alex Brown <alex_at_transitive.com> wrote:
> I have encountered the following behaviour in lattice in 2.6.1 (and
> 2.4.0) which differs depending upon the type you use. I believe the
> numeric behaviour to be correct, and the POSIXct behaviour to be in
> error.
>
> When the x data and x axis in a lattice graph are POSIXct, and when
> using scales$x$at and scales$x$labels to add custom labels:
>
> If the first visible at value is not the first specified at value (due
> to x limit settings), the first visible label nonetheless receives the
> first specified label, instead of the label corresponding to the first
> visible at.

Yes, the relevant "POSIXct" method was subsetting 'at' to lie within the specified limits but not 'labels'. Should be fixed in the next update. Thanks,

-Deepayan

> In the following example, at = baseval + 1:4, label = letters[1:4]
>
> I have set it up so that baseval + 1:2 are not visible in the graph
>
> for numeric and Date types, the visible labels are letters[3:4] - ie
> "c" "d"
>
> for POSIXct, the visible labels are letters[1:3] - "a" "b".
>
>
> Simplest to show this by example:
>
> # numeric
>
> baseval=0;
> xyplot(1:10 ~ (baseval + 1:10) , scales=list(x=list
> (at=baseval+1:4, labels=letters[1:4])),xlim=baseval+c(3,10))
>
> # Date
>
> baseval = as.Date("2007-01-01");
> xyplot(1:10 ~ (baseval + 1:10) , scales=list(x=list
> (at=baseval+1:4, labels=letters[1:4])),xlim=baseval+c(3,10))
>
> # POSIXct
>
> baseval = as.POSIXct("2007-01-01");
> xyplot(1:10 ~ (baseval + 1:10) , scales=list(x=list
> (at=baseval+1:4, labels=letters[1:4])),xlim=baseval+c(3,10))
>
> in particular, compare the Date and POSIXct versions
>
> -Alex Brown
>
> ______________________________________________
> 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.
>



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. Received on Tue 05 Feb 2008 - 21:02:27 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 Wed 06 Feb 2008 - 16:30:12 GMT.

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

list of date sections of archive