To calculate the number of NAs in the entire data.frame array, I can use sum(is.na(df), however, how can I calculate the number of NAs in each column of a large data.frame? I tried apply(df, 2, function (x) sum(is.na(df$x)), but it didn’t work.
source
share