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")
)
}
Run the code above in your browser using DataLab