[R] Subsetting data by date

From: Williams, Robin <robin.williams_at_metoffice.gov.uk>
Date: Mon, 21 Jul 2008 14:31:21 +0100


Hi all,
  Firstly I appologise if this question has been answered previously, however searching of the archives and the internet generally has not yielded any results.  

  I am looking in to the effects of summer weather conditions (temperature, humidity etc), on the incidences of a breathing disorder brought on through smoking (COPD). I am fairly new to R and completely new to the idea of writing R scripts, subsetting dataframes etc. I am working on a 12 week summer placement at the Met Office, UK, having just finished my second year of a mathematics course at university.  

  Basically I have data between January 1 1997 and December 31 2007. However as I am only interest in the summer months (which I have defined to be between May 1 and September 30), I would like to extract the relevant data in R in a timely manner. Obviously I could go and open my csv files in excel, cut and paste the relevant data, etc, however I would like to maximise R's potential as I feel it will stand me in better stead in the long run.
  Currently the dates are in the form
1-Apr-1997,
3-Sept-2001,
etc.
  I will create a data.frame with date as one of the variables, the others being (initially) temperature, humidity, and Admissions (the number of hospital admissions for COPD exaserbations).   Please could somebody tell me if there is a simple way to extract the data I want, and if so perhaps a sample command to get me going? Do I first need to format the dates to some numeric-only format? As I say, I could use Excel to create the files in the right format, but I will be dealing with a lot more variables in the future (perhaps up to 8) and so this will become a pain-staking process.  

  Please reply either on or off list.  

Many thanks for any help.
Robin Williams
Met Office summer intern - Health Forecasting robin.williams_at_metoffice.gov.uk  

        [[alternative HTML version deleted]]



R-help_at_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. Received on Mon 21 Jul 2008 - 13:42:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jul 2008 - 14:32:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive