Recursively Apply a Function to a List of Data Objects
rapply2d
is a recursive version of lapply
with two key differences to rapply
: (1) Data frames are considered as final objects, not as (sub-)lists, and (2) the result is never simplified / unlisted.
rapply2d(l, FUN, ..., classes = "data.frame")
l |
a list. |
FUN |
a function that can be applied to all elements in l. |
... |
additional elements passed to FUN. |
classes |
character. These are classes of list-based objects inside |
A list of the same structure as l
, where FUN
was applied to all final (atomic) elements and list-based objects of a class included in classes
.
l <- list(mtcars, list(mtcars, as.matrix(mtcars))) rapply2d(l, fmean) unlist2d(rapply2d(l, fmean))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.