dmirman / gazer

Functions for reading and pre-processing eye tracking data.
44 stars 11 forks source link

error using the downsample_gaze function #25

Closed JeshuaT closed 2 years ago

JeshuaT commented 2 years ago

Hi! I'm trying to us the downsample_gaze function to downsample pupil data. However, using the downsample_gaze function I stumble upon the following error:

Error in sym(timevar)/bin.length : non-numeric argument to binary operator

If you want to reproduce the error, this error is also present when trying to use the downsample_gaze function in the Pupil Preprocessing vignette. How to solve this?

jgeller112 commented 2 years ago

I cannot replicate your issue on my end. Can you show me a snippet of the data preceding this step?

jgeller112 commented 2 years ago

Try re-installing gazer. There was a pull request done a few months ago and someone changed the code underlying one of the functions and it appears it had some downstream effects.

JeshuaT commented 2 years ago

Thanks for taking a look! I've re-installed gazer with no success. This is the snippet:

timebins1<- downsample_gaze(max_pup, bin.length=200, timevar = "time", aggvars = c("subject", "script", "timebins"), type="pupil") Perhaps also relevant, here is a part of the dataframe with a few relevant columns:

trial

time subject pup_interp 1 -975.887 39 4.100150 1 -950.903 39 4.098129 1 -925.882 39 4.096475 1 -900.898 39 4.094461 1 -875.893 39 4.099740 1 -850.909 39 4.094120 1 -825.911 39 4.100825 1 -800.913 39 4.106165 1 -775.907 39 4.109270 1 -750.918 39 4.118435
jgeller112 commented 2 years ago

I can’t replicate this—it worked on the sample vignette. Given the code you pasted you are aggregating on vars you don’t have in your data. It should be aggvars = c(“subject”, “timebins”, and conditions in your file you want to aggregate on).

JeshuaT commented 2 years ago

I found the problem: there were some internal name conflicts with tidyr and dplyr. Loading tidyverse instead solved the problem. Nothing to do with your package, which has been very helpful so far by the way! Sorry for taking your time, and thanks again for your help.