[R] sequeeze a data frame

2010-09-09 Thread array chip
Hi, suppose I have a data frame as below: dat-cbind(expand.grid(id=c(1,2,3),time=c(0,3,6),mode=c('R','L'),rep=(1:3)),y=rnorm(54)) I kind of want to squeeze the data frame into a new one with averaged y over rep for the same id, time and mode. taking average is easy with tapply: tapply(dat$y,

Re: [R] sequeeze a data frame

2010-09-09 Thread David Winsemius
On Sep 9, 2010, at 5:47 PM, array chip wrote: Hi, suppose I have a data frame as below: dat- cbind (expand .grid (id=c(1,2,3),time=c(0,3,6),mode=c('R','L'),rep=(1:3)),y=rnorm(54)) I kind of want to squeeze the data frame into a new one with averaged y over rep for the same id, time

Re: [R] sequeeze a data frame

2010-09-09 Thread array chip
: r-help@r-project.org Sent: Thu, September 9, 2010 3:21:15 PM Subject: Re: [R] sequeeze a data frame On Sep 9, 2010, at 5:47 PM, array chip wrote: Hi, suppose I have a data frame as below: dat-cbind(expand.grid(id=c(1,2,3),time=c(0,3,6),mode=c('R','L'),rep=(1:3)),y=rnorm(54)) ) I kind

Re: [R] sequeeze a data frame

2010-09-09 Thread Peter Alspach
...@comcast.net To: array chip arrayprof...@yahoo.com Cc: r-help@r-project.org Sent: Thu, September 9, 2010 3:21:15 PM Subject: Re: [R] sequeeze a data frame On Sep 9, 2010, at 5:47 PM, array chip wrote: Hi, suppose I have a data frame as below: dat- cbind(expand.grid(id=c(1,2,3),time=c(0,3,6

Re: [R] sequeeze a data frame

2010-09-09 Thread array chip
Subject: RE: [R] sequeeze a data frame Tena koe John ?aggregate maybe? HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of array chip Sent: Friday, 10 September 2010 11:13 a.m. To: David Winsemius Cc: r