mt_remap_symmetric() Error in if ((remap_ypos == "up" & trajectories[i, nlogs, ypos] < 0) | :
Hello all!
I've been using mousetrap for a project I'm working on at my job and have usually been able to figure out any issues I have, but I keep coming across an error for one subject in the data. Whenever I try to remap the data I get this error:
Error in if ((remap_ypos == "up" & trajectories[i, nlogs, ypos] < 0) | :
missing value where TRUE/FALSE needed
I'm not quite sure how to fix this and the only thing I can say about the data is that the subject that completed the task had some trouble (i.e. click on the wrong picture, go to the wrong picture and hover over it then go to the right picture, or even not move the mouse for a few seconds aka dozing off)
Any input would help because this is the only error I come across when I run the mousetrap preprocessing steps (mt_align_start, mt_time_normalize, mt_subset). Thanks!
Comments
I should mention that I am using data from EPrime. We take the .txt file and export it as a .csv file so that I can read it in R. The only difference with my mousetrap preprocessing steps is that we have to align our data first and then remap. I believe it has something to do with the way the mouse-tracking experiment is setup in EPrime. I can confirm that those steps work as I've already produced results/plots. I'm just have issues with this particular subject.. I think it has to do with how inconsistent their trajectories are, but I don't know how to handle that issue. Thanks!
Hi,
that's an interesting error and without knowing more about the data it is a bit hard to uncover the source.
I took a look at the code of mt_remap_symmetric again (I assume that this is the remapping function you are using): The error specifically seems to occur because the last checked y position is a missing value (NA) (see code here: https://github.com/PascalKieslich/mousetrap/blob/master/R/preprocess.R#L218). This might happen because the number of logged y coordinates is less than the number of logged x coordinates (inernally, the function uses the number of x coordinates to determine the last position in a specific trial).
In practice, this should never happen, but you could check whether this is the case in your data by running:
Best,
Pascal
Hi Pascal,
Thanks so much for responding! This definitely helps because after looking through the data more, I was able to find that for some subjects, all the data didn't export leaving some missing values for the logged coordinates (as you mentioned is the case).