Learn R Programming

tidycomm (version 0.0.1)

add_index: Add index

Description

Add a rowwise mean or sum index of specific variables to the dataset.

Usage

add_index(data, name, ..., type = "mean", na.rm = TRUE)

Arguments

data
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 NA values should be stripped before the computation proceeds. Defaults to TRUE.

Value

a tibble

See Also

get_reliability() to compute reliability estimates of added index variables.

Examples

Run this code
# NOT RUN {
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")

# }

Run the code above in your browser using DataLab