What is the problem? The code in your post seems to work fine: > Lines <- "Date Time Value + 12/31/99 22:00:00 1.8 + 12/31/99 23:00:00 1.9 + 01/01/00 00:00:00 1.8 + 01/01/00 01:00:00 1.7 + 01/01/00 02:00:00 1.6 + 01/01/00 03:00:00 1.5 + 01/01/00 04:00:00 1.4 + 01/01/00 05:00:00 1.4" > > DF <- read.table(textConnection(Lines), header = TRUE, as.is = TRUE) > library(zoo) > library(chron) > z <- zoo(DF$Value, chron(DF$Date, DF$Time)) > z (12/31/99 22:00:00) (12/31/99 23:00:00) (01/01/00 00:00:00) (01/01/00 01:00:00) 1.8 1.9 1.8 1.7 (01/01/00 02:00:00) (01/01/00 03:00:00) (01/01/00 04:00:00) (01/01/00 05:00:00) 1.6 1.5 1.4 1.4
On Tue, Mar 30, 2010 at 4:33 PM, Christina Karamperidou <ck4...@gmail.com> wrote: > Truly sorry about before. > So, it works perfectly fine when I do it at the turn of the century, but > still when I try it on my full record, I get the same problem. Maybe it is > reading in the table in a wrong way. I just read it in as > DF <- read.table("myfile.dat", header = TRUE, as.is = TRUE) > maybe I should just cut and paste parts of z and get it to start in 1913... > I really appreciate your time. thx > Lines <- "Date Time Value > 12/31/99 22:00:00 1.8 > 12/31/99 23:00:00 1.9 > 01/01/00 00:00:00 1.8 > 01/01/00 01:00:00 1.7 > 01/01/00 02:00:00 1.6 > 01/01/00 03:00:00 1.5 > 01/01/00 04:00:00 1.4 > 01/01/00 05:00:00 1.4" > DF <- read.table(textConnection(Lines), header = TRUE, as.is = TRUE) > library(zoo) > library(chron) > z <- zoo(DF$Value, chron(DF$Date, DF$Time)) > z > > Christina K. > ck4...@gmail.com > P Please consider the environment - Do you really need to print this email? > > > On Mar 30, 2010, at 3:48 PM, Gabor Grothendieck wrote: > > Not for me. > > Please provide your data and code in reproducible form as per last > line of every r-help message and the posting guide. > > Lines <- "Date Time Value > > + 01/01/13 00:00:00 1.6 > + 01/01/13 01:00:00 1.6 > + 01/01/13 02:00:00 1.6 > + 01/01/13 03:00:00 1.6 > + 01/01/13 04:00:00 1.6 > + 01/01/13 05:00:00 1.6 > + 01/01/13 06:00:00 1.6 > + 01/01/13 07:00:00 1.6 > + 01/01/13 08:00:00 1.6 > + 01/01/13 09:00:00 1.6" > > DF <- read.table(textConnection(Lines), header = TRUE, as.is = TRUE) > > library(zoo) > > Warning message: > closing unused connection 3 (Lines) > > library(chron) > > z <- zoo(DF$Value, chron(DF$Date, DF$Time)) > > z > > (01/01/13 00:00:00) (01/01/13 01:00:00) (01/01/13 02:00:00) (01/01/13 > 03:00:00) > 1.6 1.6 1.6 > 1.6 > (01/01/13 04:00:00) (01/01/13 05:00:00) (01/01/13 06:00:00) (01/01/13 > 07:00:00) > 1.6 1.6 1.6 > 1.6 > (01/01/13 08:00:00) (01/01/13 09:00:00) > 1.6 1.6 > > > On Tue, Mar 30, 2010 at 3:32 PM, Christina Karamperidou > <ck4...@gmail.com> wrote: > > Dear all, > > I have a time series of daily measurements that starts like this: > > KWhourly[1:10,] > > Date Time Value > > 01/01/13 00:00:00 1.6 > > 01/01/13 01:00:00 1.6 > > 01/01/13 02:00:00 1.6 > > 01/01/13 03:00:00 1.6 > > 01/01/13 04:00:00 1.6 > > 01/01/13 05:00:00 1.6 > > 01/01/13 06:00:00 1.6 > > 01/01/13 07:00:00 1.6 > > 01/01/13 08:00:00 1.6 > > 01/01/13 09:00:00 1.6 > > I am trying to get average daily, monthly, yearly values using the zoo > package. > > My series starts at 01/01/13 00:00:00 and ends at 12/31/05 23:00:00 > > I create the zoo object: > > #z <- zoo(KWhourly$Value,chron(KWhourly$Date, KWhourly$Time)) > > but then z starts at: > > start(z) > > [1] (01/01/30 00:00:00) > > and ends at: > > end(z) > > [1] (12/31/29 23:00:00) > > instead of going from 01/01/13 to 12/31/05 > > any ideas why this is happening and how to fix it? > > I really appreciate your help > > > Christina K. > > Columbia University > > ck4...@gmail.com > > P Please consider the environment - Do you really need to print this email? > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > > R-help@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@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.