Thank you Peter, yes this is what I need!
John
- Original Message
From: Peter Alspach
To: array chip ; David Winsemius
Cc: "r-help@r-project.org"
Sent: Thu, September 9, 2010 4:26:53 PM
Subject: RE: [R] "sequeeze" a data frame
Tena koe John
?aggregate
may
.org
> Subject: Re: [R] "sequeeze" a data frame
>
> Thank you David. I probably didn't make my question clear enough. In
> the end, I
> want a "shorter" version of the original data frame, basically with
> variable
> "rep" removed, then just
p@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=
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,
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(
5 matches
Mail list logo