Ironing Waffle Charts to Analyze Visits to National Parks

Ironing Waffle Charts to Analyze Visits to National Parks

I have to admit, this Waffle package has a sense of humor.  It’s pretty clever to label the function for combining waffle charts “iron”.

After my look into the traffic patterns for the Grand Canyon, I wanted to get a sense of context for how visitation to the Grand Canyon differs from other large Intermountain region parks.  I again pulled data from the Nation Parks Service here. This time I selected Yellowstone, Zion, and Bryce Canyon in addition to the Grand Canyon.

Next, I repeated the steps for loading and cleaning the data.


##Repeat for Multi Park
visits<- read.csv(file="Multi_Park_Visits_2016.csv", header=TRUE, sep=",", quote = "\"", row.names=NULL)

visits$Park<- as.character(visits$TrafficCount)
visits$TrafficCount <- gsub(",","",visits$TrafficCount)
visits$TrafficCount<- as.numeric(visits$TrafficCount)
visits$ParkName<- as.character(visits$ParkName)

Again, I wanted some summary stats on visitation, but this time parsed out by park name. As a reminder, I’m using the package Mosaic to do this. From this table we can see that Bryce Canyon has the highest average number of visitors per site a month, but the lowest number of observations.  That’s because there is only 1 measurement station at Bryce and the other parks have several.


favstats(visits$TrafficCount~visits$ParkName)
visits$ParkName     min   Q1            median  Q3             max         mean        sd             n
1 Bryce Canyon NP 9423 23893.75 58633.5   82289.25  84035      52152.33  30501.78  12
2 Grand Canyon NP 0      1124.00   19709.5   42604.25  168653    40123.29  53071.10  48
3 Yellowstone NP     0      0.00          20575.0   55421.25  167896    37055.01  43988.40  72
4 Zion NP                   0      0.00          9416.0    41336.75   102856    23358.55  31723.69  60

Ok, moving on to summarizing the data.  We’re using dplyr here to get the counts by entrance so we can build our cleaned data arrays for the waffle charts.

sites <- select(visits, ParkName, TrafficCounter, TrafficCount)

sites<- sites %>%
group_by(ParkName, TrafficCounter) %>%
summarize(total=sum(TrafficCount))

head(arrange(sites, ParkName, total))

A tibble: 16 x 3
# Groups: ParkName [4]
ParkName TrafficCounter total

1 Bryce Canyon NP TRAFFIC COUNT AT ENTRANCE STATION 625828
2 Grand Canyon NP TRAFFIC COUNT (TUWEEP) 15269
3 Grand Canyon NP TRAFFIC COUNT (NORTH RIM) 127096
4 Grand Canyon NP TRAFFIC COUNT (DESERT VIEW) 289792
5 Grand Canyon NP TRAFFIC COUNT (SOUTH DISTRICT) 1493761
6 Yellowstone NP TRAFFIC COUNT AT NORTHEAST GATE 103982

Now, it’s time to build an array for each chart.  This involves some manual entry from the table (which I don’t love), but it’s an easy way to clean up labels and order the data points in one fell swoop.


br_can<- c(`Single Entrance`=625828)
gr_can <- c(`South District`=1493761, `Desert View`=289792,
`North Rim`=127096, `Tuweep`=15269)
ylw <- c(`Highway 191`=1043212, `West Gate`=660356, `North Gate`=373931,
`South Gate`=291632, `East Gate`=194848, `Northeast Gate`=103982)
zion<- c(`South Entrance`=899828, `East Entrance`=396707, `Kolob Canyon`=104977)

All that’s left is to iron them all together!Notice that I’ve adjusted the color palettes to account for a different number of categories at each park.

iron(
waffle(ylw/15000, rows=5, use_glyph = "child", glyph_size = 5,
colors=c("midnightblue","deeppink3", "deeppink2", "darkorange1", "darkorange2","gold"),
title="Total Yellowstone Visitors by Site, 2016"),
waffle(gr_can/15000, rows=4, use_glyph = "child", glyph_size = 5,
colors=c("midnightblue","deeppink3", "darkorange1","gold"),
title="Total Grand Canyon Visitors by Site, 2016"),
waffle(zion/15000, rows=3, use_glyph = "child", glyph_size = 5,
colors=c("midnightblue","deeppink3", "gold"),
title="Total Zion Visitors by Site, 2016"),
waffle(br_can/15000, rows = 1, use_glyph = "child", glyph_size = 5,
colors = c("midnightblue"), title = "Total Bryce Canyon Visitors by Site, 2016",
xlab="1 person = 15K people")
)

And here’s the final output…looks like Yellowstone has the most visits, but spread over the most entrance points.  Grand Canyon ranks second, but is more concentrated in one area.  Zion and Bryce both look like interesting possibilities if we want to visit someplace with fewer visitors.

Visitation_by_site_2016

Leave a Reply

Your email address will not be published. Required fields are marked *