n_nonmissing | R Documentation |
Returns the number of nonmissings in a variable or dataset. If missings are an explicit level in a factor variable, this function defaults to excluding them anyway.
n_nonmissing(x, exclude = NA)
x |
variable |
exclude |
only needed for factors. defaults to NA (count level=missing as missing), setting to 0 allows you to count level=missing as nonmissing |
data(beavers)
beaver1$activ[1:10] = NA
n_nonmissing(beaver1$activ)
beaver1$activ = factor(beaver1$activ, exclude = NULL)
sum(!is.na(beaver1$activ))
n_nonmissing(beaver1$activ)
n_nonmissing(beaver1$activ, exclude = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.