[R] data manipulation: getting mean value every 5 rows

2003-07-28 Thread Federico Calboli
Dear All, I would like to ask you how to accomplish a little tricky data manipulation. I have a large dataset, looking something like: templinecagenumber 18 18 1 6678.63 18 18 1 7774.458 18 18 1 7845.902 18 18 1 9483.578

Re: [R] data manipulation: getting mean value every 5 rows

2003-07-28 Thread Spencer Graves
Have you considered aggregate [documented in help(aggregate) or www.r-project.org - search - R site search or Venables and Ripley, Modern Applied Statistics with S]? hope this helps. spencer graves Federico Calboli wrote: Dear All, I would like to ask you how to accomplish a little tricky

Re: [R] data manipulation: getting mean value every 5 rows

2003-07-28 Thread Tony Plate
x - read.table(file(clipboard), header=T) # add an extra field to define groups of 5 sequential rows x[,code] - rep(seq(len=nrow(x)/5), each=5) x temp line cage number code 118 181 6678.6301 218 181 7774.4581 318 181 7845.9021 418 181