count_na: Count the number of the missing values in a vector

Description Usage Arguments Value Examples

View source: R/count_na.R

Description

Count the number of the missing values in a vector

Usage

1

Arguments

x

Vector. A vector containing missing values

Value

the number of the missing values in the target vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
x <- c(1, 2, 3, NA, 4, 5, NA, 6, NA, 7)
count_na(x)
library(data.table)
dt <- data.table(
x = c(1, 2, 3, NA, 4, 5, NA, 6, NA, 7),
y = c(1, NA, 3, NA, 4, 5, NA, 6, NA, 7)
)
dt[, lapply(.SD, count_na)]

## End(Not run)

hxfan1227/scitools documentation built on Nov. 4, 2019, 1:51 p.m.