I am writing a function, which needs a check on whether (and which!) column (variable) has all missing values (NA, ). The following is fr
NA
sapply(b,function(X) sum(is.na(X))
This will give you the count of na in each column of the dataset and also will give 0 if there is no na present in the column
dplyr approach to finding the number of NAs for each column:
df %>% summarise_all((funs(sum(is.na(.)))))