HI, I tested the code for another set of data with added complexity. Seems to be working fine. list1<-list(data.frame(x=1:6,y=c(4,5,3,2,1,8),bw=c(4,18,12,3,4,9))) list2<-list(data.frame(x=c(1,2,18,16,15),y=c(4,5,9,2,1),bw=c(4,18,22,3,4))) list3<-list(data.frame(x=c(4,6,9),y=c(8,24,12),bw=c(14,31,36))) list4<-list(list1,list2,list3) #individual cases lapply(list4[[1]][[1]],FUN=function(x) x[which.max(x)]) lapply(list4[[2]][[1]],FUN=function(x) x[which.max(x)]) lapply(list4[[3]][[1]],FUN=function(x) x[which.max(x)])
#Whole set flatlist <- function(mylist){ lapply(rapply(mylist, enquote, how="unlist"), eval) } list5<-flatlist(list4) dat6<-data.frame(key=names(list5),dat5) dat6 aggregate(value~key,data=dat6,max) #key value #1 bw 36 #2 x 18 #3 y 24 A.K. ______________________________________ If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/apply-function-over-same-column-of-all-objects-in-a-list-tp4638681p4638829.html This email was sent by arun kirshna (via Nabble) To receive all replies by email, subscribe to this discussion: http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=subscribe_by_code&node=4638681&code=ci1oZWxwQHItcHJvamVjdC5vcmd8NDYzODY4MXwtNzg0MjM1NTA4 [[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.