add_index | R Documentation |
Add a rowwise mean or sum index of specific variables to the dataset.
add_index(data, name, ..., type = "mean", na.rm = TRUE, cast.numeric = FALSE)
data |
a tibble or a tdcmm model |
name |
Name of the index column to compute. |
... |
Variables used for the index. |
type |
Type of index to compute. Either "mean" (default) or "sum". |
na.rm |
a logical value indicating whether |
cast.numeric |
a logical value indicating whether all variables selected
for index computation should be converted to numeric. Useful if computing
indices from factor variables. Defaults to |
a tdcmm model
get_reliability()
to compute reliability estimates of added index
variables.
WoJ %>% add_index(ethical_flexibility, ethics_1, ethics_2, ethics_3, ethics_4)
WoJ %>% add_index(ethical_flexibility, ethics_1, ethics_2, ethics_3, ethics_4, type = "sum")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.