Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

n_missing

Counting missing/non-missing elements


Description

Counting missing/non-missing elements

Usage

n_missing(..., type = c("any", "all"))

n_not_missing(..., type = c("any", "all"))

n_total(..., type = c("any", "all"))

Arguments

...

vectors of equal length to be checked in parallel for missing values.

type

one of "any" (default) or "all".

Value

a vector of counts of missing or non-missing values.

Examples

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")
      )
    }

mosaicCore

Common Utilities for Other MOSAIC-Family Packages

v0.9.0
GPL (>= 2)
Authors
Randall Pruim <rpruim@calvin.edu>, Daniel T. Kaplan <kaplan@macalester.edu>, Nicholas J. Horton <nhorton@amherst.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.