I have a list of 9 lists called my.list. Each one of these 9 lists is
itself a list of 6 data.frames. Most of these data.frames have 0 rows and 0
columns.
I want to return all data.frames from the list with row numbers different
from 0.
I first created the following function:

non_empty_df <- function(l) {
    lapply(l, function(df) df[sapply(df, function(df) nrow(df) !=0)])
}

If I test this way: non_empty_df(my.list[1]) it does the job. It will
return the data.frame from the first list of my_list with rows.
Now I can't find a way to iterate the above function to all the 9 nested
lists.

Thank you for help

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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