samhforbes / PupillometryR

An R package for preparing and analysing pupillometry data
Other
42 stars 4 forks source link

Function Regressed data #4

Closed bruceewmesmo closed 4 years ago

bruceewmesmo commented 4 years ago

Hi, Thanks for you package.

I'm a bit new to programming and stuff. Sorry if my doubt is to dumb.

My experiment uses pupil dilation captured only from the right eye.

I followed your tutorial till this part and adapted my data to the needs of your scripts. But when the next step was running the function regressed data it requires 2 pupil info: left and right.

So i tried to overpass regressed_data and jump to mean_data imputing Sdata directly to it. But as I suspected regressed_creates a new vector.

Add attached one sample of my data and heres the error that appears

Error in ifelse(is.na(`pupil1 <- RPupil`), `pupil2 <- RPupil`, `pupil1 <- RPupil`) : 
  object 'pupil1 <- RPupil' not found

[sample_data.txt](https://github.com/samhforbes/PupillometryR/files/4148303/sample_data.txt)

Thanks for you attention

samhforbes commented 4 years ago

Hi @bruceewmesmo , Thanks for checking in. Not a dumb question at all. The regression analysis is only useful where you have two pupils, and so is the function to get the mean pupil size.

So in your case, where you just have RPupil, you can jump straight past those to filtering, and use your RPupil vector as the pupil column. Hope that helps - please feel free to add example code id it's not working for you.

Sam

bruceewmesmo commented 4 years ago

It worked perfectly.

Thanks for your attention :) Bruce