Skip to content
Prev 293500 / 398506 Next

apply one list to another one

Hello,


Hui Du wrote
If it's a list and you want to avoid a loop, think about lapply or similar.
(Tip: you don't want sapply.)


?lapply
lapply(names(a), function(i) subset(a[[i]], select = b[[i]]))

It's your code, but "lapplied" to all elements of your objects.
Hope this helps,

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/apply-one-list-to-another-one-tp4607386p4607453.html
Sent from the R help mailing list archive at Nabble.com.