Re: [R] how to divide data by week

2012-04-13 Thread Özgür Asar
Dear Stefano, A practical way might be as the following R> acc<-read.table("acc.txt",header=T) #reading your data into R R> acc.may<-acc[acc[,3]==5,] #subsetting data with respect to may R> acc.may.order<-acc.may[order(acc.may[,4]),] #ordering with respect to day R> mean(acc.may.order[1:7,5]) # m

Re: [R] how to divide data by week

2012-04-13 Thread Hasan Diwan
Stefano, On 13 April 2012 20:51, Stefano Sofia wrote: > I have a data frame as below specified. > From the 1st of May to the 30th of September of several years (e.g. from > 2004 to 2011) I have a frequency of accidents. > I need the mean of accidents divided by weeks (i.e. the mean of accidents >