batch_apply: Apply a function to each element in an scdf.

View source: R/batch_apply.R

batch_applyR Documentation

Apply a function to each element in an scdf.

Description

This function applies a given function to each case of a multiple case scdf, returning a list of the output of each function call.

Usage

batch_apply(scdf, fn, simplify = FALSE)

Arguments

scdf

A list of inputs to apply the function to.

fn

The function to apply to each element. Use a . as a placeholder for the scdf (e.g. describe(.)).

simplify

If simplify is TRUE and fn returns a vector of values, batch_apply will return a data frame case names.

Details

If simplify is TRUE and the function returns a vector of values, the output is combined into a data frame with case names as additional columns.

This is particularly useful for applying statistical models or summary statistics to each case in an scdf.

Value

A list of the output of each function call.

Author(s)

Juergen Wilbert

See Also

Other data manipulation functions: add_l2(), as.data.frame.scdf(), as_scdf(), fill_missing(), moving_median(), print.sc_outlier(), ranks(), rescale(), scdf(), select_cases(), set_vars(), shift(), smooth_cases(), standardize(), truncate_phase()

Examples

batch_apply(exampleAB, coef(plm(.)))


scan documentation built on April 1, 2026, 9:06 a.m.