mt_count {mousetrap} | R Documentation |
Count number of observations.
Description
Count number of observations per trial for a specified dimension (or several) in the trajectory array. This is mostly a helper function used by other functions in this package.
Usage
mt_count(data, use = "trajectories", save_as = "measures", dimensions = "xpos")
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. |
dimensions |
a character vector specifying the name of the dimension(s) that should be used for counting the number of observations. If several dimensions are specified, the number of complete observations are reported. |
Value
A mousetrap data object (see mt_example).
If a data.frame with label specified in save_as
(by default
"measures") already exists, the number of observations (called nobs
)
are added as additional column. If not, an additional data.frame
will be added.
If a trajectory array was provided directly as data
, only a named
character vector will be returned.
Author(s)
Pascal J. Kieslich
Examples
# Retrieve vector that counts number of observations
mt_count(mt_example$trajectories)