NA (Missing Values) (R)
NA is R's marker for a missing or unavailable value. It is contagious: most operations involving an NA return NA, so missing data is never silently ignored.
R
NA ('Not Available') represents missing data in any type of vector. Its defining behavior is propagation: sum(c(1, 2, NA)) is NA, and 5 > NA is NA, because R can't know the answer when a value is unknown. This forces you to handle missingness deliberately rather than getting wrong results silently.
To compute despite missing values, many functions take na.rm = TRUE (e.g. mean(x, na.rm = TRUE)) to drop NAs first. Test for missingness with is.na() — never x == NA, which itself returns NA. Distinguish NA (missing) from NULL (absent/empty) and from NaN (undefined numeric like 0/0).
Handling NA correctly is a core data-cleaning skill in R: detect with is.na(), remove with na.omit() or complete.cases(), or impute. Because NA spreads through calculations, ignoring it is rarely an accident.
Syntax
x <- c(1, NA, 3)
mean(x, na.rm = TRUE)
is.na(x)Examples
R
x <- c(10, NA, 30)
print(sum(x))
print(sum(x, na.rm = TRUE))
print(is.na(x))Output:
[1] NA
[1] 40
[1] FALSE TRUE FALSE