Skip to contents

Normalize scores using either ScoringTable objects for one or more variables. Given data.frame should also contain columns used in GroupingConditions attached to the table (if any)

Usage

normalize_scores_scoring(
  data,
  vars,
  ...,
  retain = FALSE,
  group_col = NULL,
  .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

...

ScoringTable objects to be used for normalization. They should be provided in the same order as vars

retain

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

group_col

name of the column for name of the group each observation was qualified into. If left as default NULL, they won't be returned. Ignored if no conditions are available

.dots

ScoringTable objects provided as a list, instead of individually in ....

Value

data.frame with normalized scores

See also

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

Examples

# Scoring table to export / import #
suppressMessages(
  Consc_ST <- 
    GroupedFrequencyTable(
      data = IPIP_NEO_300,
      conditions = GroupConditions("Sex", "M" ~ sex == "M", "F" ~ sex == "F"), 
      var = "C") |>
    GroupedScoreTable(scale = STEN) |>
    to_ScoringTable(min_raw = 60, max_raw = 300)
)

# normalize scores
Consc_norm <- 
  normalize_scores_scoring(
    data = IPIP_NEO_300,
    vars = "C",
    Consc_ST,
    group_col = "Group"
  )

str(Consc_norm)
#> 'data.frame':	13161 obs. of  2 variables:
#>  $ Group: chr  "F" "F" "F" "M" ...
#>  $ C    : num  6 3 6 6 5 6 6 7 3 NA ...