bnicenboim / eeguana

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

drop_incomplete_segments() - new option to remove only if all channels are NA #164

Open themeo opened 3 years ago

themeo commented 3 years ago

At present drop_incomplete_segments() drops the segment if any channel is NA. It would be useful to have a parameter to remove segments only if all channels are NA.

so the logic would be the following:

x %>% dplyr::group_by(.id) %>%
  dplyr::filter_at(channel_names(.),
                   dplyr::any_vars(!is.na(.)))
bnicenboim commented 3 years ago

Sure, that seems straightforward. But to be sure, the code that you posted works, right?

themeo commented 3 years ago

Yes it does. :) It is based on your code, just changed all-not-NA to any-not-NA and got rid of all() function in the middle because in this case it was not necessary.

bnicenboim commented 3 years ago

ok, then feel free to make a pull request to the experimental branch ;) I guess there could be a parameter all set to TRUE by default.

Do you want to give it a try?

also I'm slowly making my internal functions to be based on data table, to speed up things, if you want to code it in data table, you're more than welcome.

themeo commented 3 years ago

Sure, I'll be happy to give it a try after I'm done with moving.

bnicenboim commented 7 months ago

Not sure if you're still using the package. If so, is this still relevant? I think using this function solves the issue: https://bruno.nicenboim.me/eeguana/reference/eeg_events_to_NA.html