Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

saving additional variables when importing long format data


I am trying to use mousetrap together with EEG data. Psychopy (which I use to collect mouse data) and EEG equipment send two different types of time (EEG is more precise).

My mouse data is output in the "long" format. Columns are SUBJ_ID, X, Y, Time, MT_ID, STIM_ID and EEG_TIME.

How can I preserve EEG_Time when importing mousetrap data? I tried using add_labels argument, but I don't know how to access them later. Many thanks!


  • edited November 2019

    Hi there,

    you are correct, you can use the add_labels argument. The code should look something like this:

    mt_data <- mt_import_long(
      mt_id_label="MT_ID", # I assume this is your trial identifier?

    In the resulting dataset, the trajectory array should then contain an additional dimension called "EEG_TIME" with the EEG timestamps.

    In many mousetrap functions, you can specify the dimension that contains the timestamps via the timestamps argument. E.g. mt_measures:

    mt_data <- mt_measures(mt_data, timestamps="EEG_TIME")

    Hope this helps!



  • Thank you so much!

Sign In or Register to comment.