Hello Gail,

The dat5 was in earlier post.  I forgot to paste it.
Now, your question regarding individual cases,
This is a case that includes nonnumeric columns
list1<-list(data.frame(x=1:6,y=c(4,5,3,2,1,8),bw=c(4,18,12,3,4,9),nn=paste0("a",1:6)))
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),nn=paste0("a",1:5)))

list3<-list(data.frame(x=c(4,6,9),y=c(8,24,12),bw=c(14,31,36),nn=paste0("a",1:3)))
 
 list4<-list(list1,list2,list3)
b<-list()
 for(i in 1:3){
 b[[i]]<-list()
 b[[i]]<-lapply(list4[[i]][[1]],FUN=function(x) x[which.max(x)])
 }
 b
[[1]]
[[1]]$x
[1] 6

[[1]]$y
[1] 8

[[1]]$bw
[1] 18

[[1]]$nn
[1] a6
Levels: a1 a2 a3 a4 a5 a6


[[2]]
[[2]]$x
[1] 18

[[2]]$y
[1] 9

[[2]]$bw
[1] 22

[[2]]$nn
[1] a5
Levels: a1 a2 a3 a4 a5


[[3]]
[[3]]$x
[1] 9

[[3]]$y
[1] 24

[[3]]$bw
[1] 36

[[3]]$nn
[1] a3
Levels: a1 a2 a3

I haven't looked into your dataset that was posted now.  The main problem
was that I was constructing my own data, guessing how your dataset looks
like.

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-tp4638681p4638870.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