Re: [R] Summing daily data for each year

2010-03-17 Thread Gabor Grothendieck
Try this. We read in the data using read.zoo and then aggregate it. read.zoo assumes Date class unless you indicate otherwise. Then we compute the year and aggregate over that. as.numeric(format(time(z), "%Y")) would be an alternate way to compute the year. Lines <- "1995-04-01 0.002766309 1995-

Re: [R] Summing daily data for each year

2010-03-17 Thread Bill.Venables
nables CSIRO/CMIS Cleveland Laboratories -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of santosh.ar...@csiro.au Sent: Wednesday, 17 March 2010 3:22 PM To: r-help@r-project.org Subject: [ExternalEmail] [R] Summing daily data for each

[R] Summing daily data for each year

2010-03-17 Thread Santosh.Aryal
Hello there I have a DAILY data set (as shown below) with Date and Streamflow from April 1995 to Aug 2006. I want a yearly sum the streamflow value (for each year - first and last incomplete year). Does anyone know how to do this in R? I have tried everything I could think of, e.g. importe

Re: [R] Summing daily data for each year

2010-03-16 Thread Tal Galili
HI Santosh, The simplest way I can think of is (after you import the data) to do: tapply(Zvo$V2, YEAR, sum) The question is how to get "YEAR". You could do that if you know how to play with date objects. Another option is to do something like: YEAR <- as.data.frame(strsplit(Zvo$V2, "-"))[1,] F

[R] Summing daily data for each year

2010-03-16 Thread Santosh.Aryal
Hello there I have a DAILY data set (as shown below) with Date and Streamflow from April 1995 to Aug 2006. I want a yearly sum the streamflow value (for each year - first and last incomplete year). Does anyone know how to do this in R? I have tried everything I could think of, e.g. i