mt_import_mousetrap accepts a data.frame of (merged) raw data from a
mouse-tracking experiment implemented in OpenSesame using one of the
mt_import_mousetrap creates a mousetrap data
object containing the trajectories and additional data for further processing
within the mousetrap package. mt_import_mousetrap returns a list,
which includes the trajectory data as an array, and all other data as a
data.frame. This data structure can then be passed on to other functions
within this package, such as mt_time_normalize or
mt_calculate_measures.mt_import_mousetrap(raw_data, xpos_label = "xpos", ypos_label = "ypos",
timestamps_label = "timestamps", mt_id_label = NULL, split = ", ",
duplicates = "remove_first", reset_timestamps = TRUE,
show_progress = TRUE)raw_data need to be
provided. All other arguments have sensible defaults.
The column names for the timestamps, x- and y-positions are extracted using
grep to find the column that starts with the respective character
string (these will typically also contain the name of the item that was used
to record them, such as xpos_track_mouse). This means that the exact
column names do not have to be provided - as long as mouse-tracking data was
collected only by a single item throughout the experiment (i.e., if only one
column contains timestamps, xpos, and ypos respectively). Otherwise, the
exact column names have to be specified.
duplicates allows for different options to handle duplicate timestamps
within a trial: remove_first: First timestamp and
corresponding x-/y-positions are removed (the default).remove_last: Last timestamp and corresponding x-/y-positions are
removed.ignore: Duplicates are kept.readbulk library
for reading and combining raw data files that were collected with
OpenSesame.
mt_import_wide and mt_import_long for importing mouse-tracking
data from other sources.mt_example <- mt_import_mousetrap(mt_example_raw)Run the code above in your browser using DataLab