I have a list of 10 data frames where every element represents a different variable.
l1 <- list(d1=data.frame(a=c(1,2,3), b=c(4,5,6)),
d2=data.frame(a=c(3,2,1), b=c(6,5,4)),
d3=data.frame(a=c(2,2,2), b=c(5,5,5)))
I would like to get a mean on every corresponding element of all data frames. So for element [1,1], I would have a mean of (1,3,2). I can do it for a single position with:
m1_1<-mean(unlist(lapply(l1, function(x) (x[[1,1]]))))
Is there a way to extend the indexing on the whole data frame? thanks, M.