Hello,

I am trying to define a different interval for a "year". In hydrology,
a "water year" is defined as the period between October 1st and
September 30 of the following year. I was wondering how I might do
this in R. Say I have a data.frame like the following and I want to
extract a variable with the water year specs as defined above:

df<-data.frame(Date=seq(as.Date("2000/10/1"), as.Date("2003/9/30"), "days"))

## Extract the normal year
df$year <- factor(format(as.Date(df$Date), "%Y"))

So the question is how might I define a variable that extends from
October 1st to September 30th rather than the normal January 1st to
December 31st?

Thanks in advance!

Sam

______________________________________________
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.

Reply via email to