R · Statistical analysis
Count categories including missing values
See category counts and NA values together.
Try it in three steps
- Create an example vector: x <- c("bus", "walk", "bus", NA).
- Run table(x, useNA="ifany").
- Compare category counts and NA counts with the number of observations.
How to read the output
Expected counts: bus=2, walk=1, NA=1; four observations overall.
Test your understanding.
True or false?
For c("bus", "walk", "bus", NA), a table including missing values has a bus count of 2.
Related concepts
Official source
R · Documentation ↗Documentation checked: . Steps are based on official documentation and have not been tested in the application. Menu names may differ by version and interface language.