Skip to content

Missing Data

NA - missing value

#| collapse: true
x <- c(1, 2, NA, 3, NA, 4); x
is.na(x)
sum(x)

Sum of the vector elements excluding NA values:

#| collapse: true
sum(x, na.rm = TRUE)

NULL - absence of anything

#| collapse: true
y <- c(1, NULL, 2); y
is.null(y)
length(y)

NaN, Inf

NaN and Inf values arise from arithmetic operations that are not defined.

#| collapse: true
0/0
1/0