> Hi All,
>
> I'm conducting a meta-analysis and have taken a data.frame with multiple
> rows per
> study (for each effect size) and performed a weighted average of effect
> size for
> each study. This results in a reduced # of rows. I am particularly
> interested in
> simply reducing the additional variables in the data.frame to the first row
> of the
> corresponding id variable. For example:
>
> id<-c(1,2,2,3,3,3)
> es<-c(.3,.1,.3,.1,.2,.3)
> mod1<-c(2,4,4,1,1,1)
> mod2<-c("wai","other","calpas","wai","itas","other")
> data<-as.data.frame(cbind(id,es,mod1,mod2))
>
> data
>
> id es mod1 mod2
> 1 1 0.3 2 wai
> 2 2 0.1 4 other
> 3 2 0.2 4 calpas
> 4 3 0.1 1 itas
> 5 3 0.2 1 wai
> 6 3 0.3 1 wai
>
> # I would like to reduce the entire data.frame like this:
>
> id es mod1 mod2
>
> 1 .30 2 wai
> 2 .15 4 other
> 3 .20 1 itas
>
> # If possible, I would also like the option of this (collapsing on id and
> mod2):
>
> id es mod1 mod2
> 1 .30 2 wai
> 2 0.1 4 other
> 2 0.2 4 calpas
> 3 0.1 1 itas
> 3 0.25 1 wai
>
> Any help is much appreciated!
>
> AC Del Re
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.