normalize_scores_df {stenR}R Documentation

Normalize raw scores for multiple variables

Description

Wrapper for normalize_score() that works on data frame and multiple variables

Usage

normalize_scores_df(data, vars, ..., what, retain = FALSE, .dots = list())

Arguments

data

data.frame containing raw scores

vars

names of columns to normalize. Length of vars need to be the same as number of tables provided to either ... or .dots

...

ScoreTable or FrequencyTable objects to be used for normalization

what

the values to get. One of either:

  • quan - the quantile of x in the raw score distribution

  • Z - normalized Z score for the x raw score

  • name of the scale calculated in ScoreTables provided to ... or .dots argument

retain

either boolean: TRUE if all columns in the data are to be retained, FALSE if none; or character vector with names of columns to be retained

.dots

ScoreTable or FrequencyTable objects provided as a list, instead of individually in ....

Value

data.frame with normalized scores

See Also

Other score-normalization functions: normalize_scores_grouped(), normalize_scores_scoring(), normalize_score()

Examples

# normalize multiple variables with FrequencyTable
suppressMessages({
  ft_H <- FrequencyTable(HEXACO_60$HEX_H)
  ft_E <- FrequencyTable(HEXACO_60$HEX_E)
  ft_X <- FrequencyTable(HEXACO_60$HEX_X)
})

normalize_scores_df(data = head(HEXACO_60), 
                    vars = c("HEX_H", "HEX_E", "HEX_X"),
                    ft_H,
                    ft_E,
                    ft_X,
                    what = "quan")

# normalize multiple variables with ScoreTable
st_H <- ScoreTable(ft_H, STEN)
st_E <- ScoreTable(ft_E, STEN)
st_X <- ScoreTable(ft_X, STEN)

normalize_scores_df(data = head(HEXACO_60), 
                    vars = c("HEX_H", "HEX_E", "HEX_X"),
                    st_H,
                    st_E,
                    st_X,
                    what = "sten")

[Package stenR version 0.6.9 Index]