any_by_row | R Documentation |
if all NA then return NA, else run the aimed function
any_by_row(...)
mean_by_row(...)
sum_by_row(...)
Shanquan CHEN shanquan0301@gmial.com
# judge by row, need use mapply
dat_hl <- dat_hl %>% mutate(
hearing = mapply(any_by_row, hearing_1, hearing_2),
seeing = mapply(any_by_row, seeing_1, seeing_2),
dis_comm_sup = mapply(mean_by_row, dis_comm_1, dis_comm_2)
)
# judge by group, can use directly
mdat <- dat_all %>% group_by(unique_hh) %>% summarise(
disability = any_by_row(disability_0_4, disability_5_7_without_mental, disability_adult))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.