n_missing | R Documentation |
Counting missing/non-missing elements
n_missing(..., type = c("any", "all"))
n_not_missing(..., type = c("any", "all"))
n_total(..., type = c("any", "all"))
... |
vectors of equal length to be checked in parallel for missing values. |
type |
one of |
a vector of counts of missing or non-missing values.
if (require(NHANES) && require(mosaic) && require(dplyr)) {
mosaic::tally( ~ is.na(Height) + is.na(Weight), data = NHANES, margins = TRUE)
NHANES |>
summarise(
mean.wt = mean(Weight, na.rm = TRUE),
missing.Wt = n_missing(Weight),
missing.WtAndHt = n_missing(Weight, Height, type = "all"),
missing.WtOrHt = n_missing(Weight, Height, type = "any")
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.