Hello Feng, I think you just want this...
lapply(A, function(x) apply(x[,,-c(1,2)], c(1,2), mean)) Michael On 13 October 2010 04:00, Feng Li <feng...@stat.su.se> wrote: > Dear R, > > I have a silly question concerns with *apply. Say I have a list called A, > > A <- list(a = array(1:20, c(2, 2, 5)), b = array(1:30, c(2, 3, 5))) > > I wish to calculate the mean of A$a, and A$b w.r.t. their third dimension so > I did > > lapply(A,apply,c(1,2),mean) > > Now if I still wish to do the above task but take away some burn-in, e.g. do > not take A$a[,,1:2],and A$b[,,1:2] into account. How can I do then? > > > Thanks! > > > > Feng > > > -- > Feng Li > Department of Statistics > Stockholm University > 106 91 Stockholm, Sweden > http://feng.li/ > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org 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. > ______________________________________________ R-help@r-project.org 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.