compose: Create a composite measure

View source: R/compose.R

composeR Documentation

Create a composite measure

Description

This function integrates a range of specified variables into a simple composite measure by computing the mean for each observation. By default, the respective variables are standardized in advance.

Usage

compose(data, .cols, .composite = "composite", .scale = TRUE)

Arguments

data

A data frame.

.cols

<data-masked> The names or column numbers of the numeric variables to be integrated into the composite measure.

.composite

The name of the new column for the composite measure. If no name is supplied, the new composite measure will be named "composite".

.scale

A logical indicating whether columns should be scaled in advance (i.e., by means of z standardization). The default is TRUE.

Value

An tibble containing the new composite measure named as specified in .composite.

Examples

compose(data = studach, .cols = math:read, .composite = "achievement")

sophiestallasch/multides documentation built on Oct. 20, 2024, 5:14 a.m.