R/standardize.R
mt_standardize.Rd
Standardize selected mouse-tracking measures across all trials or per level of one or more other variable, and store them in new variables. This function is a thin wrapper around scale_within, focussed on mouse-tracking data stored in a mousetrap data object.
mt_standardize( data, use = "measures", use_variables = NULL, within = NULL, prefix = "z_", center = TRUE, scale = TRUE )
data | a mousetrap data object created using one of the mt_import functions (see mt_example for details). |
---|---|
use | a character string specifying which data should be used. By
default points to the |
use_variables | a vector specifying which variables should be standardized. If unspecified, all variables will be standardized. |
within | an optional character string specifying one or more variables
in |
prefix | a character string that is inserted before each standardized variable. If an empty string is specified, the original variables are replaced. |
center | argument passed on to scale. |
scale | argument passed on to scale. |
A mousetrap data object (see mt_example) including the standardized measures.
mt_scale_trajectories for standardizing variables in mouse trajectory arrays.
scale_within which is called by mt_standardize
.
scale for the R base scale function.
mt_example <- mt_measures(mt_example) # Standardize MAD and AD per subject mt_example <- mt_standardize(mt_example, use_variables=c("MAD", "AD"), within="subject_nr", prefix="z_") # Standardize MAD and AD per subject and Condition mt_example <- mt_standardize(mt_example, use_variables=c("MAD", "AD"), within=c("subject_nr", "Condition"), prefix="z_")