mt_export_long and mt_export_wide can be used for exporting mouse-tracking data from a mousetrap data object in long or wide format. If desired, additional data (stored in data[[use2]]) can be merged with the trajectory data before export. mt_export_long and mt_export_wide are wrapper functions for mt_reshape.

mt_export_long(
  data,
  use = "trajectories",
  use_variables = NULL,
  use2 = "data",
  use2_variables = NULL,
  ...
)

mt_export_wide(
  data,
  use = "trajectories",
  use_variables = NULL,
  use2 = "data",
  use2_variables = 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 will be ignored).

use

a character string specifying which data should be exported. The corresponding data are selected from data using data[[use]]. Usually, this value corresponds to either "trajectories" or "tn_trajectories", depending on whether the raw or the time-normalized trajectories should be exported.

use_variables

a character vector specifying which mouse-tracking variables should be exported. This corresponds to the labels of the trajectory array dimensions. If unspecified, all variables will be exported.

use2

an optional character string specifying where the other trial data can be found. Defaults to "data" as data[["data"]] usually contains all non mouse-tracking trial data. Alternatively, a data.frame can be provided directly.

use2_variables

an optional character string (or vector) specifying the variables (in data[[use2]]) that should be merged with the data.

...

additional arguments passed on to mt_reshape (such as subset).

Value

A data.frame containing the exported data.

Functions

  • mt_export_long(): Export mouse-tracking data in long format

  • mt_export_wide(): Export mouse-tracking data in wide format

See also

mt_import_long for importing mouse-tracking data saved in a long format.

mt_import_wide for importing mouse-tracking data saved in a wide format.

Author

Pascal J. Kieslich

Felix Henninger

Examples

# Export data in long format
# (and include information about condition and subject_nr)
mt_data_long <- mt_export_long(mt_example,
  use2_variables=c("subject_nr","Condition"))

# Export data in wide format
# (and include information about condition and subject_nr)
mt_data_wide <- mt_export_wide(mt_example,
  use2_variables=c("subject_nr","Condition"))