Reputation: 169
I have a data frame with some columns which are strings with missing values. Is there a way (using dplyr) to efficiently calculate the percentage of each column that is missing i.e. "". So I dont have to calculate each column percentage missing individually ?
I have tried the following but dosnt seem to work
library(dplyr)
#Create data frame
a<- c(1,"",3,4)
b<- c(2,2,3,4)
c <- c("",2,"",3)
x<- data.frame(a,b,c)
x %>%
summarise_each(funs(100*mean(is.null(.))))
#Result is
#a b c
#0 0 0
Want to get something like
#a b c
#0.75 0 0.50
Upvotes: 1
Views: 583