Count total missing values by group?
问题 EDIT: input very new to this. I have a similar problem to this: group by and then count missing variables? Taking the input data from that question: df1 <- data.frame( Z = sample(LETTERS[1:5], size = 10000, replace = T), X1 = sample(c(1:10,NA), 10000, replace = T), X2 = sample(c(1:25,NA), 10000, replace = T), X3 = sample(c(1:5,NA), 10000, replace = T)) as one user proposed, it's possible to use summarise_each : df1 %>% group_by(Z) %>% summarise_each(funs(sum(is.na(.)))) #Source: local data