I have a list of data.frames, and I am wondering if there is an easy indexing method to get all third columns of all data.frames. Or all columns named x? Speaking R:
lapply(names(mylist),function(x) mylist[[x]][,3])
Is there a way to do this by simply indexing, for example mylist [[]] [, 3]? (which does not work explicitly)
EDIT: And how do you do it when you want to use a function like nlevels in it, for example
lapply(names(mylist),function(x) nlevels(mylist[[x]][,3]))
given that column 3 is a factor.
Matt bannert
source share