Learn R Programming

sjmisc (version 2.0.1)

count_na: Frequency table of tagged NA values

Description

This method counts tagged NA values (see tagged_na) in a vector and prints a frequency table of counted tagged NAs.

Usage

count_na(x)

Arguments

x
A vector with tagged NA values, or a data frame or list with such vectors.

Value

A tibble with counted tagged NA values.

Examples

Run this code
library(haven)
x <- labelled(c(1:3, tagged_na("a", "c", "z"), 4:1, tagged_na("a", "a", "c"),
                1:3, tagged_na("z", "c", "c"), 1:4, tagged_na("a", "c", "z")),
              c("Agreement" = 1, "Disagreement" = 4, "First" = tagged_na("c"),
                "Refused" = tagged_na("a"), "Not home" = tagged_na("z")))
count_na(x)

y <- labelled(c(1:3, tagged_na("e", "d", "f"), 4:1, tagged_na("f", "f", "d"),
                1:3, tagged_na("f", "d", "d"), 1:4, tagged_na("f", "d", "f")),
              c("Agreement" = 1, "Disagreement" = 4, "An E" = tagged_na("e"),
                "A D" = tagged_na("d"), "The eff" = tagged_na("f")))
count_na(tibble::data_frame(x, y))

Run the code above in your browser using DataLab