DD_vs_SB: Dunkin Donuts vs Starbucks

Description Usage Format Source Examples

Description

Number of Dunkin Donuts & Starbucks, median income, and population in 1024 census tracts in eastern Massachusetts in 2016.

Usage

1

Format

A data frame of 1024 rows representing census tracts and 6 variables

county

County where census tract is located. Either Bristol, Essex, Middlesex, Norfolk, Plymouth, or Suffolk county

FIPS

Federal Information Processing Standards code identifying census tract

median_income

Median income of census tract

population

Population of census tract

shop_type

Coffee shop type: Dunkin Donuts or Starbucks

shops

Number of shops

Source

US Census Bureau. Code used to scrape data available at https://github.com/DelaneyMoran/FinalProject

Examples

1
2
3
4
5
6
7
8
# Compute correlation between a census tract's median income and number of cafes of
# each type after removing two cases where median_income is missing
library(dplyr)
DD_vs_SB %>%
  mutate(shops_per_1000 = 1000 * shops / population) %>%
  filter(!is.na(median_income)) %>%
  group_by(shop_type) %>%
  summarize(cor = cor(median_income, shops_per_1000))

tessington/qsci381 documentation built on Sept. 26, 2020, 12:40 p.m.