bnicenboim / eeguana

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

mutate_if won't work with conditions that aren't groups, and needs to be grouped under .sample_id #96

Open bnicenboim opened 5 years ago

bnicenboim commented 5 years ago

works:

data_faces_ERPs %>% group_by(condition, .sample_id) %>%
 mutate_if(is_channel_dbl, ~ ifelse(condition=="1", channel_dbl(NA),. )) %>% mutate_if(is_channel_dbl, ~ ifelse(.id=="1", channel_dbl(NA),. ))

doesn't works:

data_faces_ERPs %>% ungroup() %>%
 mutate_if(is_channel_dbl, ~ ifelse(condition=="1", channel_dbl(NA),. )) %>% mutate_if(is_channel_dbl, ~ ifelse(.id=="1", channel_dbl(NA),. ))