table
Usage
Used to tabulate a variable in a dataframe. (It shows how many rows contain each possible value of the variable.)
Usage:
table(dataframe$variable)
- The input should be a variable in a dataframe.
- We usually don’t store the output, and display it to console instead.
Example
rm(list=ls())
df <- read.csv("IPUMS_ACS2019_CA_1.csv")
table(df$EMPSTAT)