r count na values for each variable code example Example 1: how to count the number of NA in r sum(is.na(df$col)) Example 2: r count number of na sum(is.na(df))