Hello,

I was in a hurry at the time, when I replied.
You could do one thing: extract sublist using:
list4 <- list(mango, banana, pineapple) 
b1<-list()
 for(i in 1:3){
 b1[[i]]<-list()
 b1[[i]]<-list4[[i]][1]
 }
 b1
b<-list()
 for(i in 1:3){
 b[[i]]<-list()
 b[[i]]<-lapply(b1[[i]][[1]],FUN=function(x)x[which.max(x)])
 }

b2<-data.frame(do.call(rbind,b))
row.names(b2)<-c("mango","banana","pineapple")
 b2 
 apply(b2,2, function(x) x[which.max(x)]) 
$coconut
$coconut$banana
[1] 18

I guess, this is much better than calling individual sublists.
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-tp4638681p4638907.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.

Reply via email to