
Normalize raw scores for multiple variables
normalize_scores_df.RdWrapper 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.framecontaining raw scores- vars
names of columns to normalize. Length of
varsneed to be the same as number of tables provided to either...or.dots- ...
ScoreTableorFrequencyTableobjects to be used for normalization- what
the values to get. One of either:
quan- the quantile of x in the raw score distributionZ- normalized Z score for the x raw scorename of the scale calculated in
ScoreTablesprovided to...or.dotsargument
- retain
either boolean:
TRUEif all columns in thedataare to be retained,FALSEif none; or character vector with names of columns to be retained- .dots
ScoreTableorFrequencyTableobjects provided as a list, instead of individually in....
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")
#> HEX_H HEX_E HEX_X
#> 1 88.480392 46.56863 72.794118
#> 2 72.303922 36.76471 80.637255
#> 3 2.696078 2.45098 4.166667
#> 4 5.637255 13.72549 51.470588
#> 5 39.460784 57.59804 28.676471
#> 6 48.284314 31.61765 72.794118
# 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")
#> HEX_H HEX_E HEX_X
#> 1 8 5 7
#> 2 7 5 7
#> 3 2 2 2
#> 4 2 3 6
#> 5 5 6 4
#> 6 5 5 7