Learn R Programming

gpindex (version 0.6.3)

balanced: Balanced operator

Description

Makes a function balance the removal of NAs across multiple input vectors.

Usage

balanced(f, ...)

Value

A function like f with a new argument na.rm. If na.rm = TRUE then complete.cases() is used to remove missing values across all inputs prior to calling f.

Arguments

f

A function.

...

Deprecated. Additional arguments to f that should not be balanced.

See Also

Other operators: grouped(), quantity_index()

Examples

Run this code
p2 <- price6[[3]]
p1 <- price6[[2]]
q2 <- quantity6[[3]]
q1 <- quantity6[[2]]

# Balance missing values for a Fisher index.

fisher <- balanced(fisher_index)
fisher(p2, p1, q2, replace(q1, 3, NA), na.rm = TRUE)
fisher_index(p2[-3], p1[-3], q2[-3], q1[-3])

Run the code above in your browser using DataLab