bnicenboim / eeguana

A package for manipulating EEG data in R.
https://bnicenboim.github.io/eeguana/
Other
21 stars 9 forks source link

Add ignore argument to eeg_segment #193

Closed stonekate closed 2 years ago

stonekate commented 2 years ago

For example, if I want to pull out the word after the target segment I can do:

eeg %>%  eeg_segment(lead(.description == "S100"), lim = c(-200, 1000), .unit = "milliseconds") 

but BV-preprocessed data marks UserDefined events in the events table, like Blink, so sometimes the event after S100 might be a Blink. Some way to ignore non-stimulus events would be nice? Or maybe there's already a way to do this...

bnicenboim commented 2 years ago

Why can't you just do the following?

eeg %>%  eeg_segment(lead(.description == "S100") & .description != "Blink", lim = c(-200, 1000), .unit = "milliseconds") 

The ... works exactly as dplyr::filter but since all the conditions go together in one argument, you need to do and with & rather than with ,

stonekate commented 2 years ago

Ok yeah that works totally fine, I'll close this, thx!