r count of na values 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))