Learn R Programming

validate (version 1.1.5)

add_indicators: 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)

Value

dat with extra columns defined by x attached.

Arguments

dat

[data.frame]

x

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

Examples

Run this code
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)

Run the code above in your browser using DataLab