add_indicators: Add indicator values as columns to a data frame

View source: R/indicator.R

add_indicatorsR Documentation

Add indicator values as columns to a data frame

Description

Compute and add externally defined indicators to data frame. If necessary, values are recycled over records.

Usage

add_indicators(dat, x)

Arguments

dat

[data.frame]

x

[indicator] or [indication] object. See examples.

Value

dat with extra columns defined by x attached.

Examples

ii <- indicator(
 hihi = 2*sqrt(height)
 , haha = log10(weight)
 , lulz = mean(height)
 , wo0t = median(weight)
)

# note: mean and median are repeated
add_indicators(women, ii)

# compute indicators first, then add
out <- confront(women, ii)
add_indicators(women, out)


validate documentation built on March 31, 2023, 6:27 p.m.