Take in a data frame containing circumplex scales, angle definitions for each scale, and normative data (from the package or custom) and return that same data frame with each specified circumplex scale transformed into standard scores (i.e., z-scores) based on comparison to the normative data.
Arguments
- .data
Required. A data frame containing at least circumplex scales.
- scales
Required. The variable names or column numbers for the variables in
.data
that contain circumplex scales to be standardized.- angles
Required. A numeric vector containing the angular displacement of each circumplex scale included in
scales
(in degrees).- instrument
Required. An instrument object from the package. To see the available circumplex instruments, see
instruments()
.- sample
Required. An integer corresponding to the normative sample to use in standardizing the scale scores (default = 1). See
?norms
to see the normative samples available for an instrument.- prefix
Optional. A string to include at the beginning of the newly calculated scale variables' names, before the scale name and
suffix
(default = "").- suffix
Optional. A string to include at the end of the newly calculated scale variables' names, after the scale name and
prefix
(default = "_z").
Value
A data frame that matches .data
except that new variables are
appended that contain standardized versions of scales
. These new
variables will have the same name as scales
but with a "_z" suffix.
Examples
data("jz2017")
instrument("iipsc")
standardize(jz2017, PA:NO, octants(), instrument = iipsc, sample = 1)
#> # A tibble: 1,166 × 27
#> Gender PA BC DE FG HI JK LM NO PARPD SCZPD SZTPD
#> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <int> <int>
#> 1 Female 1.5 1.5 1.25 1 2 2.5 2.25 2.5 4 3 7
#> 2 Female 0 0.25 0 0.25 1.25 1.75 2.25 2.25 1 0 2
#> 3 Female 0 0 0 0 0 0 0 0 0 1 0
#> 4 Male 2 1.75 1.75 2.5 2 1.75 2 2.5 1 0 0
#> 5 Female 0.25 0.5 0.25 0 0 0 0 0 0 0 0
#> 6 Male 1.5 1.75 2.25 1.75 2 1.25 2.25 2.5 5 5 7
#> 7 Male 2 1.75 1.75 2 1.5 1.25 1.25 1.75 3 6 7
#> 8 Female 0 0.25 0.25 0.25 1 1.25 1.25 1 0 0 1
#> 9 Female 0 0 0 0 0.25 0.25 1 0 0 1 0
#> 10 Male 0.75 2 1.75 2.5 2 1.5 2 2.25 4 5 5
#> # ℹ 1,156 more rows
#> # ℹ 15 more variables: ASPD <int>, BORPD <int>, HISPD <int>, NARPD <int>,
#> # AVPD <int>, DPNPD <int>, OCPD <int>, PA_z <dbl>, BC_z <dbl>, DE_z <dbl>,
#> # FG_z <dbl>, HI_z <dbl>, JK_z <dbl>, LM_z <dbl>, NO_z <dbl>