apply_: Apply a list of function calls to a data frame and return the...

View source: R/split_apply_.R

apply_R Documentation

Apply a list of function calls to a data frame and return the results in a list

Description

Apply a list of function calls to a data frame and return the results in a list

Usage

apply_(.data, fun_list = list(n = ~nrow(.data)))

Arguments

.data

a data frame.

fun_list

a named list of formulas with the desired function calls to be evalutated on the data frame. The default value (list(n = ~nrow(.data))) returns the number of rows (observations) and stores it in a column named n.

Value

a named list with the results of the function calls applied to the data frame.

Examples

str(invented_wages)

# First create a list of function calls (with formulas)
fun <- list(m1 = ~weighted.mean(wage, sample_weights), s = ~sum(sample_weights))

# And then apply them to the data
apply_(invented_wages, fun_list = fun)

gibonet/cuber documentation built on Dec. 24, 2024, 5:17 p.m.