mt_import_long receives a data.frame in which mouse-tracking data are
stored in long format, i.e., where one row contains the logging data
(timestamp, x- and y-position etc.) at one specific point in the trial. This
is, for example, the case when exporting the trajectory data from the
mousetrap package using mt_reshape. From this data.frame,
mt_import_long creates a mousetrap data object containing the
trajectories and additional data for further processing within the mousetrap
package. mt_import_long 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. The defaults are
set so that no adjustments have to be made when importing a data.frame that
was created using mt_reshape.
mt_import_long(raw_data, xpos_label = "xpos", ypos_label = "ypos", timestamps_label = "timestamps", dist_label = "dist", vel_label = "vel", acc_label = "acc", mt_id_label = mt_id, mt_seq_label = "mt_seq", reset_timestamps = TRUE)mt_seq_label parameter (mt_seq by default). If the
corresponding column does not exist, the coordinates will be ordered
according to their timestamps (drawn from the timestamps column by
default).
## Not run:
# exp_data <- read.csv("exp_data.csv")
# data <- mt_import_long(exp_data)
# ## End(Not run)
Run the code above in your browser using DataLab