eeguana icon indicating copy to clipboard operation
eeguana copied to clipboard

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

Open themeo opened this issue 3 years ago • 5 comments

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(.)))

themeo avatar Apr 07 '21 07:04 themeo

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

bnicenboim avatar Apr 07 '21 07:04 bnicenboim

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.

themeo avatar Apr 07 '21 22:04 themeo

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.

bnicenboim avatar Apr 08 '21 13:04 bnicenboim

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

themeo avatar Apr 10 '21 17:04 themeo

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

bnicenboim avatar Mar 12 '24 12:03 bnicenboim