Import data
data <- read_excel("../00_data/myData.xlsx")
data
## # A tibble: 21,560 × 12
## year gnis_id geometry metad…¹ numbe…² parkn…³ region state unit_…⁴ unit_…⁵
## <dbl> <dbl> <chr> <chr> <dbl> <chr> <chr> <chr> <chr> <chr>
## 1 1904 1163670 POLYGON NA 1 Crater… PW OR CRLA Crater…
## 2 1941 1531834 MULTIPOLY… NA 1 Lake R… PW WA LARO Lake R…
## 3 1961 2055170 MULTIPOLY… NA 1 Lewis … PW WA LEWI Lewis …
## 4 1935 1530459 MULTIPOLY… NA 1 Olympic PW WA OLYM Olympi…
## 5 1982 277263 POLYGON NA 1 Santa … PW CA SAMO Santa …
## 6 1919 578853 MULTIPOLY… NA 1 NA NE ME ACAD Acadia…
## 7 1969 1329499 MULTIPOLY… NA 1 NA IM TX AMIS Amista…
## 8 1967 589056 POLYGON NA 1 NA NE MD ASIS Assate…
## 9 1944 1377082 POLYGON NA 1 NA IM TX BIBE Big Be…
## 10 1989 302659 POLYGON NA 1 NA SE FL BICY Big Cy…
## # … with 21,550 more rows, 2 more variables: unit_type <chr>, visitors <dbl>,
## # and abbreviated variable names ¹metadata, ²number_of_records, ³parkname,
## # ⁴unit_code, ⁵unit_name
Explain data and variables
The data I selected is the National Park Visits data set from Tidy
Tuesday. It looks at the number of visitors at many national parks
located across the United States between the years 1904 to 2016, as well
as a number of other variables. The variables that I used to answer my
question were year, parkname, region, state, unit_name, unit_type, and
visitors. Year is the year the data was from, parkname and unit_name are
the names of the national park, region and state are where they are
located, unit_type is the type of park it is, and visitors are the
number of visitors that visited that park that year.
Define Question
Has the number of visits to National parks increased or decreased
over the years?
Analyze data to answer the question
# Scatter plot of the number of visitors per year based on region
ggplot(data = data) +
geom_point(mapping = aes(x = year, y = visitors, color = region)) +
ylim(0,10000000)
## Warning: Removed 492 rows containing missing values (geom_point).

# Count how much data was collected per region
data %>%
mutate(region = fct_relevel(region,
"NT", "AK", "NC", "MW", "PW", "SE", "NE", "IM")) %>%
ggplot(aes(region, color = region)) +
geom_bar()

# Individual scatter plots for the two regions with the most data
IM_region <- filter(data, region == "IM")
ggplot(data = IM_region) +
geom_point(mapping = aes(x = year, y = visitors, color = region)) +
ylim(0,6000000)
## Warning: Removed 83 rows containing missing values (geom_point).

NE_region <- filter(data, region == "NE")
ggplot(data = NE_region) +
geom_point(mapping = aes(x = year, y = visitors, color = region)) +
ylim(0,10000000)
## Warning: Removed 74 rows containing missing values (geom_point).

# Mean number of visitors in the year 1910
beg_data <- filter(data, year == 1910)
mean(beg_data$visitors)
## [1] 19268.44
# Mean number of visitors in the year 2010
end_data <- filter(data, year == 2010)
mean(end_data$visitors)
## [1] 762982.4
Interpret
To find out if the number of visits to national parks has increased
or decreased over the years I first created a scatter plot to show the
number of visitors per year per region. Because of the size of my data
set, it is hard to read. Next, I counted how much data was collected for
each region. I found that the IM and NE regions had the most data. So I
created the exact same scatter plot for just the IM region and for the
NE region. Both of regions contained parks that maintained relatively
low visitors throughout the whole dataset. However, it is clear there is
an upward trend in both of these plots as well as the one including all
of the regions.
Another method I used to answer my question was by finding the mean
number of visitors. I filtered the data first to just include data from
1910, one of the earliest years in this data set, and then to 2010, one
of the latest years in the data set. I took the mean number of visitors
from each of these years and found that in 2010 the mean number of
visitors was just about 40 times greater than the mean number of
visitors in 1910.
After organizing the data in different ways I am confident that the
number of visitors at national parks has increased since 1904. I think
it is because transportation became more accessible over the years and
information about the parks spread by word of mouth, publications, and
newer technology.