Learn R Programming

openintro (version 2.4.0)

census: Random sample of 2000 U.S. Census Data

Description

A random sample of 500 observations from the 2000 U.S. Census Data.

Usage

census

Arguments

Format

A data frame with 500 observations on the following 8 variables.

census_year

Census Year.

state_fips_code

Name of state.

total_family_income

Total family income (in U.S. dollars).

age

Age.

sex

Sex with levels Female and Male.

race_general

Race with levels American Indian or Alaska Native, Black, Chinese, Japanese, Other Asian or Pacific Islander, Two major races, White and Other.

marital_status

Marital status with levels Divorced, Married/spouse absent, Married/spouse present, Never married/single, Separated and Widowed.

total_personal_income

Total personal income (in U.S. dollars).

Examples

Run this code

library(dplyr)
library(ggplot2)

census %>%
  filter(total_family_income > 0) %>%
  ggplot(aes(x = total_family_income)) +
  geom_histogram(binwidth = 25000)

Run the code above in your browser using DataLab