I want to count the number of NA
values in a data frame column. Say my data frame is called df
, and the name of the column I am considering is col
. The way I have come up with is following:
sapply(df$col, function(x) sum(length(which(is.na(x)))))
Is this a good/most efficient way to do this?