r - Determine the number of NA values in a column -


i want count number of na values in data frame column. data frame called df, , name of column considering col. way have come following:

sapply(df$col, function(x) sum(length(which(is.na(x)))))   

is good/most efficient way this?

you're over-thinking problem:

sum(is.na(df$col)) 

Comments