Re: [R] Subsetting data by date

2008-07-21 Thread Gabor Grothendieck
26 PM > To: Williams, Robin > Cc: R-help@r-project.org > Subject: Re: [R] Subsetting data by date > > Continuing on, to just get points from May to Sep > > mo <- as.numeric(format(time(z), "%m")) > z.summer <- z[mo >= 5 & mo <= 9] > > If in your case

Re: [R] Subsetting data by date

2008-07-21 Thread John Kane
?subset is one of several ways. You don't need a loop. Loops are BAD in R :) --- On Mon, 7/21/08, Williams, Robin <[EMAIL PROTECTED]> wrote: > From: Williams, Robin <[EMAIL PROTECTED]> > Subject: Re: [R] Subsetting data by date > To: "Gabor Grothendieck"

Re: [R] Subsetting data by date

2008-07-21 Thread John Kane
PM > To: Williams, Robin > Cc: R-help@r-project.org > Subject: Re: [R] Subsetting data by date > > Continuing on, to just get points from May to Sep > > mo <- as.numeric(format(time(z), "%m")) > z.summer <- z[mo >= 5 & mo <= 9] > > If in your case

Re: [R] Subsetting data by date

2008-07-21 Thread Williams, Robin
] -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Monday, July 21, 2008 3:26 PM To: Williams, Robin Cc: R-help@r-project.org Subject: Re: [R] Subsetting data by date Continuing on, to just get points from May to Sep mo <- as.numeric(format(time(z),

Re: [R] Subsetting data by date

2008-07-21 Thread Williams, Robin
Forecasting [EMAIL PROTECTED] -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Monday, July 21, 2008 3:26 PM To: Williams, Robin Cc: R-help@r-project.org Subject: Re: [R] Subsetting data by date Continuing on, to just get points from May to Sep mo <- as.nume

Re: [R] Subsetting data by date

2008-07-21 Thread Gabor Grothendieck
Continuing on, to just get points from May to Sep mo <- as.numeric(format(time(z), "%m")) z.summer <- z[mo >= 5 & mo <= 9] If in your case z is multivariate rather than univariate (as it is in our example) then it would be: z.summer <- z[mo >= 5 & mo <= 9, ] On Mon, Jul 21, 2008 at 9:55 AM, Gabo

Re: [R] Subsetting data by date

2008-07-21 Thread Gabor Grothendieck
Try this: Lines <- "Date,Temp 1-Apr-1997,50 3-Sept-2001,60" library(zoo) # function to reduce 4 char mos to 3 char convert.date <- function(x, format) as.Date(sub("(-...).-", "\\1-", x), format) # z <- read.zoo("myfile.csv", header = TRUE, sep = ",", FUN = convert.date, format = "%d-%b-%Y") z <

[R] Subsetting data by date

2008-07-21 Thread Williams, Robin
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 dis