Learn R Programming

collapse (version 1.1.0)

rapply2d: Recursively Apply a Function to a List of Data Objects

Description

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 not simplified.

Usage

rapply2d(l, FUN, ...)

Arguments

l

a list.

FUN

a function that can be applied to all elements in l.

...

additional elements passed to FUN.

Value

A list of the same structure as l, where FUN was applied to all elements.

See Also

unlist2d, List Processing, Collapse Overview

Examples

Run this code
# NOT RUN {
l <- list(mtcars, list(mtcars, as.matrix(mtcars)))
rapply2d(l, fmean)
unlist2d(rapply2d(l, fmean))
# }

Run the code above in your browser using DataLab