I've got dozens of lists, each is a collection of 11 data frames. Some data frames are empty (another script did not output any data, not a bug).
I need to push each list through a function but that chokes when it sees an empty data frame. So how do I write a function that will take a list, do a dim on each element (i.e. data frame) and if it's 0, then skip to the next.
I tried something like this:
empties <- function (mlist)
{
for(i in 1:length(mlist))
{
if(dim(mlist[[i]])[1]!=0) return (mlist[[i]])
}
}
But clearly, that didn't work. I would do this manually at this point but that would take forever. Help?