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-
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
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
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
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
5 matches
Mail list logo