I\'d like to show the names of columns in a large dataframe that contain missing values. Basically, I want the equivalent of complete.cases(df) but for columns, not rows. Some o
One way...
nacols <- function(x){ y <- sapply(x, function(xx)any(is.na(xx))) names(y[y]) } nacols(tmp) [1] "y" "z"
Explanation: since the result y is a logical vector, names(y[y]) returns the names of y for only those cases where y is TRUE.
y
names(y[y])