mt_import with data collected by PsychoPy
Hi all,
I have made mouse-tracking experiment using PsychoPy. In my data files ".csv" i have three columns that are intersting for me and they are mouse.x, mouse.y and mouse.time. I have very (i hope) simple problem with importing it to data.frame using mousetrap package in RStudio.
I tried in two ways
1:
raw_data <- read_bulk(extension = ".csv")
mt_import_mousetrap(raw_data, xpos_label = "mouse.x", ypos_label = "mouse.y", timestamps_label = "mouse.time")
there are a lot of warnings - FUN(newX[, i], ...) occured NA after transformations
and "error in command - 'if (any(diff(current_timestamps) < 0)) {': missing value TRUE/FALSE"
2:
raw_data <- read_bulk(extension = ".csv")
mt_import_wide(raw_data, xpos_label = "mouse.x", ypos_label = "mouse.y", timestamps_label = "mouse.time")
No mt_id_label provided. A new trial identifying variable called mt_id was created.
No pos_ids provided. The following variables were found using grep:
error in command 'mt_import_wide(raw_data, xpos_label = "mouse.x", ypos_label = "mouse.y", ':
No variables found for xpos.
And there is this column/variable, I can see it in raw_data.
I don't know what to do next.
If anyone could help me, I would be very thankfull. Which of theese mt_import i should use? And how to create correct command, to import my data?
I add attachment with one of my data files, if anyone would like to see how it looks.
Sorry for my English, I tried my best.
Kuba
Comments
Hi Kuba,
I took a quick look at your dataset and wrote a demo script that reads the data into R and imports them into mousetrap.
This script worked for me with your demo file. It is basically the first variant you describe above but with an additional filter that excludes all rows in your dataset that do not contain mouse-tracking data (where e.g. mouse.x is either NA or has the value "" (empty character)). This filter of course needs to be improved by you given that I don't know what is contained in the different rows (i.e., which rows should enter the analysis).
Hope this helps!
Best,
Pascal