Skip to content
Prev 155710 / 398502 Next

request: most repeated component of a list

That is indeed different from what I thought the first time.

x <- sapply(1:length(l), function(x) {
   sum(sapply(l, function(y) {
     if ( nrow(l[[x]]) != nrow(y) | ncol(l[[x]]) != ncol(y) ) FALSE
     else sum(y != l[[x]]) == 0
   }))
} )

names(x) <- names(l)

Then, x has the same names as l, and x[i] is the number of matches that
l[[i]] has...so you want the index or indices of max(x).

--Adam
On Thu, 11 Sep 2008, Muhammad Azam wrote: