BergelsonLab / blabr

Other
1 stars 3 forks source link

clean up get_lena_speaker_stats #26

Open kalenkovich opened 2 years ago

kalenkovich commented 2 years ago

Due to peculiarities of its files (or my code, not sure), there are extra NA.

See aclew.R in ACLEW_correllations in vihi_sample in one_time_scripts to see what actually happens there.

add_its_stats(add_stats_function = get_lena_speaker_stats) %>%
  # Sometimes some numeric columns in its files (as read by rlena) are
  # inexplicably NA instead of zero ¯\_(ツ)_/¯. We'd rather have zeros there
  # unless it is a fully NA row signifying an interval with no LENA segments.
  mutate(across(c(adult_word_count, utterance_count, segment_duration),
                ~ if_else(is.na(spkr), true = .x,
                          false = replace_na(.x, 0)))) %>%