v <- c(1, NA, 3, NA, 5) # is.na() flags missing values print(is.na(v)) # keep only the non-missing ones print(v[!is.na(v)])
detect and drop NA