hunt <- read.csv("IL_hunting_lic.csv",skip=1) %>%
rename(year=TXNL_LICN_YEAR,county=COUNTY) %>%
mutate(county=factor(trimws(county,which="right")),
License=factor(trimws(License,which="right")))
str(hunt)
head(hunt)
hunt2 <- filterD(hunt,year %in% c("2006","2007","2008","2009","2010","2011"))
str(hunt2)
hunt3 <- filterD(hunt2,county %in% c("COOK","KANE","LAKE","MCHENRY"))
str(hunt3)
theme_CK <- theme_bw() +
theme(legend.title=element_blank(),
legend.background=element_rect(fill="khaki"),
legend.key=element_rect(color="black"),
legend.key.size=unit(4,"mm"),
legend.text=element_text(size=8),
axis.title.x = element_blank(),
plot.title = element_text(face="bold",size=rel(1.4)),
plot.subtitle = element_text(size=rel(1.1)),
plot.background=element_rect(fill="khaki",color="black"),
axis.title.y=element_text(face="bold",size=12),
axis.text.y=element_text(size=9))
theme_CK2 <- theme_bw() +
theme(legend.position="none",
axis.title.x = element_blank(),
plot.title = element_text(face="bold",size=rel(1.4)),
plot.subtitle = element_text(size=rel(1.1)),
plot.background=element_rect(fill="khaki",color="black"),
axis.title.y=element_text(face="bold",size=12),
axis.text.y=element_text(size=9),
axis.text.x.bottom=element_blank(),
axis.ticks.x=element_blank())
clrs1 <- c("#999999","#666633","#99FF99","#000000","#E69F00","#56B4E9",
"#009E73","#F0E442","#0072B2","#D55E00","#CC79A7","#996600",
"#CC3366")
The following graph comes from a set of data on the sales of Illinois Hunting Licenses provided by illinois.gov. The data were compiled by the Illinois Department of Natural Resources from 2006-2012, with counties and hunting license types as factor variables. In preparation, I filtered the data to narrow the focus from 2006-2011, as the data for 2012 seemed inconsistent. With this graph, I wanted to learn about the overall trends in sales over time in Illinois and how they differed among license types statewide.
hunt_sum1 <- hunt2 %>%
group_by(year,License) %>%
summarize(freq=n()) %>%
ungroup()
hunt_sum1
p1 <- ggplot(data=hunt_sum1,mapping=aes(x=year,y=freq,fill=License)) +
geom_bar(stat="identity",color="gray30",alpha=0.7) +
scale_x_continuous(name="Year",breaks=seq(2006,2011,1)) +
scale_y_continuous(name="Frequency of All Licenses (Thousands)",
expand=expansion(mult=c(0,0.1)),
breaks=seq(0,900,300)) +
scale_fill_manual(values=clrs1) +
labs(title="Illinois Hunting License Sales",
subtitle="2006-2011") +
theme_bw() +
theme(panel.grid.major.x=element_blank(),
panel.grid.minor=element_blank()) +
theme_CK
p1
The graph above shows that on a state level, most sales by license type remained consistent over time, with both of the Lifetime licenses selling little compared to the others. This is with the exception, though, of the Natural Resources Shooting Preserve type, which steadily grew in frequency over time. The NRES Shooting Preserve data seem to be the most notable changes from 2006 to 20011.
The graph below comes from the same data set on Illinois Hunting License Sales provided by illinois.gov. With this graph, I hoped to discover more about the relationships between counties and different licenses during the period. To do this, I faceted by year and county. I filtered an additional factor to accommodate the faceting. I filtered the total 106 counties down to just four counties of the northeast part of the state. This graph is faceted by county and year to display individual county data and to make comparisons between them.
p2 <- ggplot(data=hunt3,mapping=aes(x=License,y=Number.Sold,fill=License)) +
geom_bar(alpha=.8,stat="identity") +
facet_grid(rows=vars(year),cols=vars(county)) +
scale_y_continuous(name="Frequency of Licenses") +
scale_fill_manual(values=clrs1) +
scale_color_manual(values=clrs1) +
labs(title="Illinois Hunting License Sales by County",
subtitle="2006-2011",
caption= "Source:https://data.illinois.gov/group/natural-resources?organization=department-of-natural-resources") +
theme_bw() +
theme_CK2 +
theme(panel.grid.major.x=element_blank(),
panel.grid.minor.x=element_blank())
p2
The graph above displays the differences among county sales by year and type. Judged by the graph, it seems that the Habitat Stamp and the Hunting 5-Day license types were most popular among all counties, with little change over time for any license types. Habitat Stamp frequencies dropped slightly and it appears that NRES Shooting Preserve types saw a slight increase as well. Cook county had the most overall sales, likely as it houses the greater Chicagoland area. It seems that this geographic region is similar to the state as a whole, with little change overall, but with some change in the single variable.