powered by
rapply2d is a recursive version of lapply with three differences to rapply:
rapply2d
lapply
rapply
data frames (or other list-based objects specified in classes) are considered as atomic, not as (sub-)lists
classes
FUN is applied to all 'atomic' objects in the nested list
FUN
the result is not simplified / unlisted.
rapply2d(l, FUN, ..., classes = "data.frame")
A list of the same structure as l, where FUN was applied to all atomic elements and list-based objects of a class included in classes.
l
a list.
a function that can be applied to all 'atomic' elements in l.
additional elements passed to FUN.
character. Classes of list-based objects inside l that should be considered as atomic.
rsplit, unlist2d, List Processing, Collapse Overview
rsplit
unlist2d
l <- list(mtcars, list(mtcars, as.matrix(mtcars))) rapply2d(l, fmean) unlist2d(rapply2d(l, fmean))
Run the code above in your browser using DataLab