[R] problems with xlim in plot.zoo() and window()

Gabor Grothendieck ggrothendieck at gmail.com
Tue May 29 19:44:22 CEST 2012


On Tue, May 29, 2012 at 1:39 PM, Agustin Lobo
<Agustin.Lobo at ictja.csic.es> wrote:
> Thanks!
> Using as.POSIXct() instead of as.Date() solves the problem:
>> plot(alyL32007z$NEE_st,col=cod,type="b",pch=18,xlim=as.POSIXct(c("2007-03-04 11:30:00 UTC" ,"2007-11-09 11:30:00 UTC"))) #works fine
>> delme <- window(alyL32007z, start = as.POSIXct("2007-03-04",tz="UTC"),end=as.POSIXct("2007-11-09",tz="UTC"))
>> str(delme)
> ‘zoo’ series from 2007-03-04 to 2007-11-09
>  Data: num [1:12001, 1:38] 3 3 3 3 3 3 3 3 3 3 ...
>  - attr(*, "dimnames")=List of 2
>  ..$ : NULL
>  ..$ : chr [1:38] "Month" "Day" "Hour" "doy2" ...
>  Index:  POSIXct[1:12001], format: "2007-03-04 00:00:00" "2007-03-04
> 00:30:00" "2007-03-04 01:00:00" "2007-03-04 01:30:00" "2007-03-04
> 02:00:00" "2007-03-04 02:30:00" ...
>
> Would you advice in favor of using Date objects instead of POSIXct ?
>

Read the relevant article in R News 4/1.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list