mt_scale_trajectories {mousetrap} | R Documentation |
Standardize variables in mouse trajectory array.
Description
mt_scale_trajectories
centers and / or standardizes selected
trajectory variables within or across trajectories.
Usage
mt_scale_trajectories(
data,
use = "trajectories",
save_as = use,
var_names,
center = TRUE,
scale = TRUE,
within_trajectory = FALSE,
prefix = "z_",
transform = NULL
)
Arguments
data |
a mousetrap data object created using one of the mt_import
functions (see mt_example for details). Alternatively, a trajectory
array can be provided directly (in this case |
use |
a character string specifying which trajectory data should be used. |
save_as |
a character string specifying where the resulting trajectory data should be stored. |
var_names |
character vector giving the labels of the to be standardized variables. |
center |
logical specifying whether variables should be centered (i.e.,
|
scale |
logical or numeric specifying the scaling of the variables. When
logical, |
within_trajectory |
logical specifying whether trajectory variables
should be scaled within or across trajectories. If |
prefix |
character string added to the names of the new standardized
variables. If |
transform |
function that takes a numeric matrix as argument and returns
a numeric matrix of same size with transformed values. If |
Value
A mousetrap data object (see mt_example) with an additional
variable containing the standardized trajectory variable added to the
trajectory array). If the trajectory array was provided directly as
data
, only the trajectory array will be returned.
Author(s)
Dirk U. Wulff
See Also
mt_standardize for standardizing mouse-tracking measures per level of other variables.
Examples
# Calculate derivatives
mt_example <- mt_derivatives(mt_example)
# Standardize velocity across trajectories
mt_example <- mt_scale_trajectories(mt_example,var_names = "vel")