Re: [R] Averaging over data sets

2012-01-13 Thread MacQueen, Don
Here is a solution that works for your small example. It might be difficult to prepare your larger data sets to use the same method. db <-rbind(d1,d2) aggregate(subset(db,select=-c(subject,trt)), by=list(subject=db$subject),mean) ## or, for example, aggregate(subset(db,select=-c(subject,trt)), by=

Re: [R] Averaging over data sets

2012-01-12 Thread Joshua Wiley
Hi, I might write a little function that does different things depending on the class of the variable. Along the lines of: where i is a column index: function(i) { if (is.numeric(imputeddata[, i])) { something } else if (is.factor(imputeddata[, i])) { something else } etc. then you can jus

[R] Averaging over data sets

2012-01-12 Thread Felipe Nunes
Hi all, after using Amelia II to create 10 imputed data sets I need to average them to have one unique data that includes the average for each cell of the variables imputed, in addition to the values for the variables not imputed. Such data has many variables (some numeric, other factors), and mor