Learn R Programming

volker (version 3.0.0)

add_index: Calculate the mean value of multiple items

Description

[Experimental]

Usage

add_index(data, cols, newcol = NULL, clean = TRUE)

Value

The input tibble with an additional column that contains the index values. The column contains the result of the alpha calculation in the attribute named "psych.alpha".

Arguments

data

A dataframe.

cols

A tidy selection of item columns.

newcol

Name of the index as a character value. Set to NULL (default) to automatically build a name from the common column prefix, prefixed with "idx_".

clean

Prepare data by data_clean.

Examples

Run this code
ds <- volker::chatgpt
volker::add_index(ds, starts_with("cg_adoption"))

Run the code above in your browser using DataLab