Cleaning Data
Missing values are NA. is.na finds them, na.omit removes rows with NA, and functions like mean need na.rm = TRUE. unique and duplicated handle repeats.
Example
x <- c(5, NA, 7, 5)
print(is.na(x)); print(mean(x, na.rm = TRUE)); print(unique(x))Exercise
Ignore NA in a mean.
mean(x, = TRUE)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.