powered by
length_omitna() counts only non-missing elements of a vector.
length_omitna()
length_omit_na(x)
An integer
Input vector. Either a vector, or something coercible to one.
length() counts all the elements in a vector including those that are missing (NAs).
length()
ethnicity <- c("Hausa", NA, "Yoruba", "Igbo", NA, "Fulani", "Kanuri", "Others") length_omit_na(ethnicity) length(ethnicity)
Run the code above in your browser using DataLab