Learn R Programming

SpatialEpi (version 1.2.8)

pennLC_sf: Pennsylvania Lung Cancer

Description

County-level (n=67) population/case data for lung cancer in Pennsylvania in 2002, stratified on race (white vs non-white), gender and age (Under 40, 40-59, 60-69 and 70+). Additionally, county-specific smoking rates.

Usage

pennLC_sf

Arguments

Format

An sf POLYGON data frame with 1072 rows = 67 counties x 2 race x 2 gender x 4 age bands

county

Pennsylvania county

cases

Number of cases per county split by strata

population

Population per county split by strata

race

Race (w = white and o = non-white)

gender

Gender (f = female and m = male)

age

Age (4 bands)

smoking

Overall county smoking rate (not broken down by strata)

geometry

Geometric representation of counties in Pennsylvania

Examples

Run this code
library(ggplot2)
library(dplyr)
# Sum cases & population for each county
lung_cancer_rate <- pennLC_sf %>% 
  group_by(county) %>% 
  summarize(cases = sum(cases), population = sum(population)) %>% 
  mutate(rate = cases/population)

# Static map of Pennsylvania lung cancer rates for each county
if (FALSE) {
ggplot() +
  geom_sf(data = lung_cancer_rate, aes(fill = rate))
  }

Run the code above in your browser using DataLab