I'm trying to get a minimally intuitive way of plotting zoo objects
extracted for given periods of time
I do:
▾ Quoted text (1 line)
plot(alyL32007z$NEE_st,col=cod,type="b",pch=18,xlim=time(alyL32007z)[c(3000,15000)])
and get a correct plot but the expression for xlim is hard to read by humans.
I try
▾ Quoted text (1 line)
time(alyL32007z)[c(3000,15000)]
[1] "2007-03-04 11:30:00 UTC" "2007-11-09 11:30:00 UTC"
▾ Quoted text (1 line)
plot(alyL32007z$NEE_st,col=cod,type="b",pch=18,xlim=c("2007-03-04 11:30:00 UTC" ,"2007-11-09 11:30:00 UTC"))
Error in plot.window(...) : invalid 'xlim' value
an error that makes sense, but then I try:
▾ Quoted text (1 line)
as.Date(c("2007-03-04 11:30:00 UTC" ,"2007-11-09 11:30:00 UTC"))
[1] "2007-03-04" "2007-11-09"
▾ Quoted text (1 line)
plot(alyL32007z$NEE_st,col=cod,type="b",pch=18,xlim=as.Date(c("2007-03-04 11:30:00 UTC" ,"2007-11-09 11:30:00 UTC")))
and get no error but an empty plot.
How can I set xlim using a simple expression for given dates?
I've also tried with window(), but:
▾ Quoted text (1 line)
delme <- window(alyL32007z, start = as.Date("2007-03-04"),end=as.Date("2007-11-09"))
Warning messages:
1: In which(in.index & all.indexes >= start & all.indexes <= end) :
Incompatible methods ("Ops.POSIXt", "Ops.Date") for ">="
2: In which(in.index & all.indexes >= start & all.indexes <= end) :
Incompatible methods ("Ops.POSIXt", "Ops.Date") for "<="
?zoo? series (without observations)
▾ Quoted text (2 lines)
delme <- window(alyL32007z, start = c(2007, 3), end = c(2007, 12))
str(delme)
?zoo? series (without observations)
Is this a problem with the way I've made the dates? (using as.POSIXct())
Data in http://dl.dropbox.com/u/3180464/alyL32007z.rda
http://dl.dropbox.com/u/3180464/alyL32007.rda
alyL32007z <- zoo(alyL32007[-1],alyL32007$time)
Agus
▾ Signature
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
e-mail Agustin.Lobo at ictja.csic.es
https://sites.google.com/site/aloboaleu/
Message-ID:
<CALPC6DPDK7JA7kqPW9+Oj5_fwtawwxQGp-xQCsH57cKHSFv+sA@mail.gmail.com>