I'm doing:> alyL32007z <- zoo(alyL32007,alyL32007$time) > range(time(alyL32007z))[1] "2007-01-01 00:00:00 UTC" "2007-12-31 23:30:00 UTC" But then, while the original variable is:> summary(alyL32007$NEE_st)Min. 1st Qu. Median Mean 3rd Qu. Max. NA's -15.340 -1.615 -0.054 -0.814 0.750 8.965 11124 the variable within the zoo object is different:> summary(alyL32007z$NEE_st)Index alyL32007z$NEE_st Min. :2007-01-01 00:00:00 0.335: 7 1st Qu.:2007-04-02 05:52:30 0.582: 7 Median :2007-07-02 11:45:00 0.611: 7 Mean :2007-07-02 11:45:00 0.063: 6 3rd Qu.:2007-10-01 17:37:30 0.069: 6 Max. :2007-12-31 23:30:00 (Other): 6363 NA's :11124 and I get an error at plotting:> plot(alyL32007z$NEE_st)Error in plot.window(...) : invalid 'ylim' value Any help appreciated, Thanks Agus -- 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/
Gabor Grothendieck
2012-May-28 16:11 UTC
[R] zoo: variable gets modified at making zoo object
On Mon, May 28, 2012 at 5:35 AM, Agustin Lobo <Agustin.Lobo at ictja.csic.es> wrote:> I'm doing: > >> alyL32007z <- zoo(alyL32007,alyL32007$time) >> range(time(alyL32007z)) > [1] "2007-01-01 00:00:00 UTC" "2007-12-31 23:30:00 UTC" > > But then, while the original variable is: >> summary(alyL32007$NEE_st) > ? Min. 1st Qu. ?Median ? ?Mean 3rd Qu. ? ?Max. ? ?NA's > -15.340 ?-1.615 ?-0.054 ?-0.814 ? 0.750 ? 8.965 ? 11124 > > the variable within the zoo object is different: >> summary(alyL32007z$NEE_st) > ? ? Index ? ? ? ? ? ? ? ? ? ? alyL32007z$NEE_st > ?Min. ? :2007-01-01 00:00:00 ? ? 0.335: ? ?7 > ?1st Qu.:2007-04-02 05:52:30 ? ? 0.582: ? ?7 > ?Median :2007-07-02 11:45:00 ? ? 0.611: ? ?7 > ?Mean ? :2007-07-02 11:45:00 ? ? 0.063: ? ?6 > ?3rd Qu.:2007-10-01 17:37:30 ? ? 0.069: ? ?6 > ?Max. ? :2007-12-31 23:30:00 ? (Other): 6363 > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NA's ? :11124 > > and I ?get an error at plotting: >> plot(alyL32007z$NEE_st) > Error in plot.window(...) : invalid 'ylim' value > > Any help appreciated, > > Thanks > Agus > -- > 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/ > > ______________________________________________ > 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.Read the last two lines and particularly the part about posting reproducible code. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
Gabor Grothendieck
2012-May-28 23:29 UTC
[R] zoo: variable gets modified at making zoo object
On Mon, May 28, 2012 at 5:35 AM, Agustin Lobo <Agustin.Lobo at ictja.csic.es> wrote:> I'm doing: > >> alyL32007z <- zoo(alyL32007,alyL32007$time)The POSIXct time is erroneously being used twice: once as part of the data and once as the index. It should be: alyL32007z <- zoo(alyL32007[-1], alyL32007$time) or alyL32007z <- read.zoo(alyL32007, FUN = identity) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com