Dear R users,

I am currently working in subsetting a zooreg() object using either window or 
subset. I have a solution but it may be a bit cumbersome when I start working 
with actual data. Your inputs would be greatly appreciated.

Example: I have a zooreg() object that starts in 1997 and ends in 2001. This 
object contains daily data for the 4 years

aa<-zooreg(1:1825,start=as.Date("1997-01-01"))

My aim is to subset the data according to seasons (Southern Hemisphere) for 
continuous years: December - January - February (DJF-Summer: 1997-2001), March 
- April - May (MAM-Autumn: 1997-2001), June - July - August (JJA-Winter: 
1997-2001), September - October - November (SON-Spring: 1997-2001) thereby 
analysing the seasons data only for all years. The example below is only for 
DJF but I would like to replicate the analysis for each season.

My solution so far uses subset to select the monthly data for each year and 
then rbind() the results.

bb <- subset(aa, 
index(aa)>=as.Date("1998-12-01")&index(aa)<=as.Date("1999-02-28"))
cc <- subset(aa, 
index(aa)>=as.Date("1999-12-01")&index(aa)<=as.Date("2000-02-28"))
dd <- subset(aa, 
index(aa)>=as.Date("2000-12-01")&index(aa)<=as.Date("2001-02-28"))

ee<- rbind(bb,cc,dd)

The method above appears to do the job just fine except that I have around 30 
locations (catchments) each with varying data availability and some with over 
20 years worth of data. Ideally I would like to combine the second set of 
commands into a single command where I specify the start and end year and the 
months that I am interested in.

Any advice on this matter would be greatly appreciated.

Many thanks and kind regards,
Wesley

Wesley Roberts PhD.
Researcher: Earth Observation
Natural Resources & the Environment (NRE)
CSIR
Tel: +27 (0)21 888-2490
Fax: +27 (0)21 888-2693
skype: roberts-w
 
 



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.

______________________________________________
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