dimension_reduction {tidyindex} | R Documentation |
The dimension reduction module
Description
The module combines multiple variables into a new variable. The new variable
can be a linear combination of the original variables,
aggregate_linear()
, or a geometric mean of the original variables,
aggregate_geometry()
, or created from an user formula input,
aggregate_manual()
.
Usage
dimension_reduction(data, ...)
aggregate_linear(formula, weight)
aggregate_geometrical(formula)
aggregate_manual(formula)
Arguments
data |
used in |
... |
used in |
formula |
the formula to evaluate |
weight |
used in |
Value
an index table object
Examples
dt <- gggi |>
dplyr::select(country, sex_ratio_at_birth:healthy_life_expectancy) |>
init()
dt |>
dimension_reduction(health = aggregate_manual(
~sex_ratio_at_birth * 0.693 + healthy_life_expectancy * 0.307))
dt |>
add_paras(gggi_weights, by = variable) |>
dimension_reduction(health = aggregate_linear(
~sex_ratio_at_birth:healthy_life_expectancy, weight = var_weight))
dt |>
dimension_reduction(health = aggregate_geometrical(
~sex_ratio_at_birth:healthy_life_expectancy)
)
[Package tidyindex version 0.1.0 Index]