The purpose of this analysis is to find the top 10 rock climbing locations with the highest number of sport routes to create bar plots showing the route counts at each of these locations and their difficulty distributions.
Once these bar plots are developed, we’ll create a custom cognostic to identify which of the top 10 locations in terms of # routes also have an average rating for their climbs that’s >=2.5.
Data Source: Mountain Project: US Rock Climbing Routes
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
library(purrr)
library(ggplot2)
library(trelliscopejs)
## Warning: package 'trelliscopejs' was built under R version 4.6.2
## This package is no longer maintained. Please use the 'trelliscope' package instead (see https://github.com/trelliscope/).
Rock_Climbing_Data <- read.csv("C:/Users/bsko1/OneDrive/Desktop/Data Visualization Course/Week 4/Assignment 4/Mountain Project Routes.csv")
str(Rock_Climbing_Data)
## 'data.frame': 151037 obs. of 11 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Route : chr "Dreamscape" "Misty" "Comfortably Numb" "Oyster" ...
## $ Location : chr "Sun Wall > Cherokee Rock Village (Sand Rock) > Alabama" "Sun Wall > Cherokee Rock Village (Sand Rock) > Alabama" "The Pinnacle > Cherokee Rock Village (Sand Rock) > Alabama" "Holiday Block > Cherokee Rock Village (Sand Rock) > Alabama" ...
## $ URL : chr "https://www.mountainproject.com/route/105979968/dreamscape" "https://www.mountainproject.com/route/105905421/misty" "https://www.mountainproject.com/route/105905196/comfortably-numb" "https://www.mountainproject.com/route/105926850/oyster" ...
## $ Avg.Stars : num 3.9 3.7 3.6 3.2 3.2 3.1 3 3 2.9 2.9 ...
## $ Route.Type : chr "Sport" "Sport" "Trad, TR" "Sport" ...
## $ Rating : chr "5.11c" "5.10b/c" "5.9" "5.10a" ...
## $ Pitches : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Length : int 75 90 120 80 70 35 NA 40 80 60 ...
## $ Area.Latitude : num 34.2 34.2 34.2 34.2 34.2 ...
## $ Area.Longitude: num -85.8 -85.8 -85.8 -85.8 -85.8 ...
table(Rock_Climbing_Data$Route.Type)
##
## Sport
## 70272
## Sport, Aid
## 81
## Sport, Aid, Alpine
## 5
## Sport, Aid, Boulder, Mixed
## 1
## Sport, Alpine
## 1864
## Sport, Boulder
## 100
## Sport, Boulder, Alpine
## 1
## Sport, Boulder, Mixed
## 1
## Sport, Mixed
## 21
## Sport, Mixed, Alpine
## 1
## Sport, Mixed, Ice
## 1
## Sport, Snow
## 1
## Sport, TR
## 4068
## Sport, TR, Aid
## 12
## Sport, TR, Aid, Boulder
## 1
## Sport, TR, Aid, Mixed
## 1
## Sport, TR, Alpine
## 86
## Sport, TR, Boulder
## 22
## Sport, TR, Mixed
## 20
## Sport, TR, Mixed, Ice
## 1
## TR
## 173
## TR, Alpine
## 8
## TR, Boulder
## 10
## Trad
## 55014
## Trad, Aid
## 1274
## Trad, Aid, Alpine
## 119
## Trad, Aid, Boulder
## 1
## Trad, Aid, Boulder, Alpine
## 1
## Trad, Aid, Boulder, Mixed, Ice, Snow, Alpine
## 1
## Trad, Aid, Ice
## 1
## Trad, Aid, Ice, Alpine
## 4
## Trad, Aid, Mixed, Ice, Alpine
## 3
## Trad, Aid, Mixed, Ice, Snow
## 1
## Trad, Aid, Mixed, Snow
## 1
## Trad, Aid, Mixed, Snow, Alpine
## 1
## Trad, Aid, Snow
## 1
## Trad, Aid, Snow, Alpine
## 3
## Trad, Alpine
## 4653
## Trad, Boulder
## 263
## Trad, Boulder, Alpine
## 6
## Trad, Boulder, Mixed
## 1
## Trad, Boulder, Mixed, Alpine
## 1
## Trad, Boulder, Mixed, Ice
## 1
## Trad, Ice
## 16
## Trad, Ice, Alpine
## 21
## Trad, Ice, Snow
## 6
## Trad, Ice, Snow, Alpine
## 43
## Trad, Mixed
## 18
## Trad, Mixed, Alpine
## 11
## Trad, Mixed, Ice
## 21
## Trad, Mixed, Ice, Alpine
## 18
## Trad, Mixed, Ice, Snow
## 17
## Trad, Mixed, Ice, Snow, Alpine
## 22
## Trad, Mixed, Snow
## 2
## Trad, Mixed, Snow, Alpine
## 21
## Trad, Snow
## 10
## Trad, Snow, Alpine
## 191
## Trad, Sport
## 2248
## Trad, Sport, Aid
## 19
## Trad, Sport, Aid, Alpine
## 1
## Trad, Sport, Alpine
## 50
## Trad, Sport, Boulder
## 2
## Trad, Sport, TR
## 127
## Trad, TR
## 9777
## Trad, TR, Aid
## 29
## Trad, TR, Aid, Alpine
## 1
## Trad, TR, Aid, Boulder, Mixed, Ice, Snow, Alpine
## 1
## Trad, TR, Alpine
## 162
## Trad, TR, Boulder
## 92
## Trad, TR, Boulder, Alpine
## 1
## Trad, TR, Mixed
## 8
## Trad, TR, Mixed, Ice
## 1
Sport_Routes <- filter(Rock_Climbing_Data, Route.Type == "Sport")
# Checking updated sport route variable.
table(Sport_Routes$Route.Type)
##
## Sport
## 70272
str(Sport_Routes)
## 'data.frame': 70272 obs. of 11 variables:
## $ X : int 1 2 4 5 6 7 8 10 11 12 ...
## $ Route : chr "Dreamscape" "Misty" "Oyster" "Pigs in Zen (Tuesday's Gone)" ...
## $ Location : chr "Sun Wall > Cherokee Rock Village (Sand Rock) > Alabama" "Sun Wall > Cherokee Rock Village (Sand Rock) > Alabama" "Holiday Block > Cherokee Rock Village (Sand Rock) > Alabama" "Holiday Block > Cherokee Rock Village (Sand Rock) > Alabama" ...
## $ URL : chr "https://www.mountainproject.com/route/105979968/dreamscape" "https://www.mountainproject.com/route/105905421/misty" "https://www.mountainproject.com/route/105926850/oyster" "https://www.mountainproject.com/route/105930746/pigs-in-zen-tuesdays-gone" ...
## $ Avg.Stars : num 3.9 3.7 3.2 3.2 3.1 3 3 2.9 2.8 2.9 ...
## $ Route.Type : chr "Sport" "Sport" "Sport" "Sport" ...
## $ Rating : chr "5.11c" "5.10b/c" "5.10a" "5.10d" ...
## $ Pitches : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Length : int 75 90 80 70 35 NA 40 60 75 40 ...
## $ Area.Latitude : num 34.2 34.2 34.2 34.2 34.2 ...
## $ Area.Longitude: num -85.8 -85.8 -85.8 -85.8 -85.8 ...
colSums(is.na(Sport_Routes))
## X Route Location URL Avg.Stars
## 0 0 0 0 0
## Route.Type Rating Pitches Length Area.Latitude
## 0 0 0 8049 0
## Area.Longitude
## 0
table(Sport_Routes$Rating)
##
## 3rd 3rd PG13 3rd X 4th 5
## 17 1 2 7 29
## 5.0 PG13 5.1 5.10- 5.10- PG13 5.10- R
## 1 1254 688 18 6
## 5.10- X 5.10 PG13 5.10 R 5.10 X 5.10+
## 1 30 13 1 969
## 5.10+ PG13 5.10+ R 5.10+ X 5.10a 5.10a PG13
## 18 8 2 4183 102
## 5.10a R 5.10a X 5.10a/b 5.10a/b PG13 5.10a/b R
## 26 3 668 18 3
## 5.10a/b X 5.10b 5.10b PG13 5.10b R 5.10b X
## 2 3446 75 25 3
## 5.10b/c 5.10b/c PG13 5.10b/c R 5.10b/c X 5.10c
## 726 22 3 1 3172
## 5.10c PG13 5.10c R 5.10c X 5.10c/d 5.10c/d PG13
## 60 23 2 472 15
## 5.10c/d R 5.10c/d X 5.10d 5.10d PG13 5.10d R
## 2 2 2499 51 16
## 5.10d X 5.11 5.11- 5.11- PG13 5.11- R
## 2 1043 708 20 3
## 5.11- X 5.11 PG13 5.11 R 5.11 X 5.11+
## 2 22 5 4 806
## 5.11+ PG13 5.11+ R 5.11a 5.11a PG13 5.11a R
## 20 5 3745 61 17
## 5.11a/b 5.11a/b PG13 5.11a/b R 5.11b 5.11b PG13
## 533 14 1 3230 43
## 5.11b R 5.11b/c 5.11b/c PG13 5.11b/c R 5.11c
## 17 698 14 7 2899
## 5.11c PG13 5.11c R 5.11c X 5.11c/d 5.11c/d PG13
## 38 14 2 425 12
## 5.11c/d R 5.11d 5.11d PG13 5.11d R 5.11d X
## 3 2489 42 11 2
## 5.12 5.12- 5.12- PG13 5.12- R 5.12- X
## 564 490 8 3 1
## 5.12 PG13 5.12 R 5.12 X 5.12+ 5.12+ PG13
## 14 8 1 385 6
## 5.12+ R 5.12a 5.12a PG13 5.12a R 5.12a X
## 2 3816 64 11 1
## 5.12a/b 5.12a/b PG13 5.12a/b R 5.12a/b X 5.12b
## 526 9 2 1 2685
## 5.12b PG13 5.12b R 5.12b/c 5.12b/c PG13 5.12c
## 36 8 459 11 2012
## 5.12c PG13 5.12c R 5.12c X 5.12c/d 5.12c/d PG13
## 20 6 1 238 2
## 5.12c/d R 5.12d 5.12d PG13 5.12d R 5.13
## 1 1374 15 4 237
## 5.13- 5.13- PG13 5.13- R 5.13 PG13 5.13+
## 200 2 3 1 104
## 5.13+ PG13 5.13+ R 5.13a 5.13a PG13 5.13a R
## 2 1 1581 17 1
## 5.13a/b 5.13a/b PG13 5.13b 5.13b PG13 5.13b R
## 154 5 881 6 2
## 5.13b/c 5.13b/c PG13 5.13c 5.13c PG13 5.13c/d
## 122 1 539 6 61
## 5.13c/d PG13 5.13d 5.13d PG13 5.13d R 5.14
## 1 355 2 1 46
## 5.14- 5.14- PG13 5.14+ 5.14a 5.14a PG13
## 56 2 13 291 2
## 5.14a/b 5.14b 5.14b PG13 5.14b/c 5.14c
## 21 117 2 15 45
## 5.14c/d 5.14d 5.15 5.15- 5.15+
## 3 25 6 2 1
## 5.15a 5.15d 5.2 5.2 PG13 5.2 R
## 4 2 44 1 2
## 5.3 5.3 PG13 5.3 R 5.4 5.4 PG13
## 82 2 3 211 9
## 5.4 R 5.4 X 5.5 5.5 PG13 5.5 R
## 6 1 485 17 8
## 5.5 X 5.6 5.6 PG13 5.6 R 5.6 X
## 1 1297 31 21 3
## 5.7 5.7 PG13 5.7 R 5.7 X 5.7+
## 2412 63 28 2 427
## 5.7+ PG13 5.7+ R 5.7+ X 5.8 5.8-
## 18 8 1 3622 250
## 5.8- PG13 5.8- R 5.8 PG13 5.8 R 5.8 X
## 5 1 85 31 2
## 5.8+ 5.8+ PG13 5.8+ R 5.8+ X 5.9
## 878 35 10 1 4462
## 5.9- 5.9- PG13 5.9- R 5.9 PG13 5.9 R
## 495 15 3 112 41
## 5.9 X 5.9+ 5.9+ PG13 5.9+ R Easy 5th
## 7 1568 55 20 23
## Easy 5th PG13 Easy 5th R
## 3 1
Sport_Routes$Difficulty <- Sport_Routes$Rating
# Creating a group of all rating descriptions that contain the Grade Range "5.9".
Sport_Routes$Difficulty[grep("5.9", Sport_Routes$Rating)] <- "5.9"
# Creating a group of all rating descriptions that contain the Grade Range "5.10".
Sport_Routes$Difficulty[grep("5.10", Sport_Routes$Rating)] <- "5.10"
# Creating a group of all rating descriptions that contain the Grade Range "5.11".
Sport_Routes$Difficulty[grep("5.11", Sport_Routes$Rating)] <- "5.11"
# Creating a group of all rating descriptions that contain the Grade Range "5.12".
Sport_Routes$Difficulty[grep("5.12", Sport_Routes$Rating)] <- "5.12"
# Creating a group of all rating descriptions that contain the Grade Range "5.13".
Sport_Routes$Difficulty[grep("5.13", Sport_Routes$Rating)] <- "5.13"
# Creating a group of all rating descriptions that contain the Grade Range "5.14".
Sport_Routes$Difficulty[grep("5.14", Sport_Routes$Rating)] <- "5.14"
# Creating a group of all rating descriptions that contain the Grade Range "5.15".
Sport_Routes$Difficulty[grep("5.15", Sport_Routes$Rating)] <- "5.15"
# Checking all categories to make sure there isn't 5.11-, 5.10a, etc.
# For instance, seeing a 5.11 and 5.11a would mean the grouping didn't work as expected.
table(Sport_Routes$Difficulty)
##
## 3rd 3rd PG13 3rd X 4th 5
## 17 1 2 7 29
## 5.0 PG13 5.1 5.10 5.11 5.12
## 1 1254 17376 16955 12784
## 5.13 5.14 5.15 5.2 5.2 PG13
## 4285 638 15 44 1
## 5.2 R 5.3 5.3 PG13 5.3 R 5.4
## 2 82 2 3 211
## 5.4 PG13 5.4 R 5.4 X 5.5 5.5 PG13
## 9 6 1 485 17
## 5.5 R 5.5 X 5.6 5.6 PG13 5.6 R
## 8 1 1297 31 21
## 5.6 X 5.7 5.7 PG13 5.7 R 5.7 X
## 3 2412 63 28 2
## 5.7+ 5.7+ PG13 5.7+ R 5.7+ X 5.8
## 427 18 8 1 3622
## 5.8- 5.8- PG13 5.8- R 5.8 PG13 5.8 R
## 250 5 1 85 31
## 5.8 X 5.8+ 5.8+ PG13 5.8+ R 5.8+ X
## 2 878 35 10 1
## 5.9 Easy 5th Easy 5th PG13 Easy 5th R
## 6778 23 3 1
# There doesn't appear to be any of the grouped route ratings not in the expected groups that were created.
# Checking 5.9 category to make sure only routes with 5.9 are contained in the group.
table(Sport_Routes$Rating[Sport_Routes$Difficulty == "5.9"])
##
## 5.9 5.9- 5.9- PG13 5.9- R 5.9 PG13 5.9 R 5.9 X 5.9+
## 4462 495 15 3 112 41 7 1568
## 5.9+ PG13 5.9+ R
## 55 20
# This category has the expected values.
# Checking 5.10 category to make sure only routes with 5.10 are contained in the group.
table(Sport_Routes$Rating[Sport_Routes$Difficulty == "5.10"])
##
## 5.10- 5.10- PG13 5.10- R 5.10- X 5.10 PG13 5.10 R
## 688 18 6 1 30 13
## 5.10 X 5.10+ 5.10+ PG13 5.10+ R 5.10+ X 5.10a
## 1 969 18 8 2 4183
## 5.10a PG13 5.10a R 5.10a X 5.10a/b 5.10a/b PG13 5.10a/b R
## 102 26 3 668 18 3
## 5.10a/b X 5.10b 5.10b PG13 5.10b R 5.10b X 5.10b/c
## 2 3446 75 25 3 726
## 5.10b/c PG13 5.10b/c R 5.10b/c X 5.10c 5.10c PG13 5.10c R
## 22 3 1 3172 60 23
## 5.10c X 5.10c/d 5.10c/d PG13 5.10c/d R 5.10c/d X 5.10d
## 2 472 15 2 2 2499
## 5.10d PG13 5.10d R 5.10d X
## 51 16 2
# This category has the expected values.
# Checking 5.11 category to make sure only routes with 5.11 are contained in the group.
table(Sport_Routes$Rating[Sport_Routes$Difficulty == "5.11"])
##
## 5.11 5.11- 5.11- PG13 5.11- R 5.11- X 5.11 PG13
## 1043 708 20 3 2 22
## 5.11 R 5.11 X 5.11+ 5.11+ PG13 5.11+ R 5.11a
## 5 4 806 20 5 3745
## 5.11a PG13 5.11a R 5.11a/b 5.11a/b PG13 5.11a/b R 5.11b
## 61 17 533 14 1 3230
## 5.11b PG13 5.11b R 5.11b/c 5.11b/c PG13 5.11b/c R 5.11c
## 43 17 698 14 7 2899
## 5.11c PG13 5.11c R 5.11c X 5.11c/d 5.11c/d PG13 5.11c/d R
## 38 14 2 425 12 3
## 5.11d 5.11d PG13 5.11d R 5.11d X
## 2489 42 11 2
# This category has the expected values.
# Checking 5.12 category to make sure only routes with 5.12 are contained in the group.
table(Sport_Routes$Rating[Sport_Routes$Difficulty == "5.12"])
##
## 5.12 5.12- 5.12- PG13 5.12- R 5.12- X 5.12 PG13
## 564 490 8 3 1 14
## 5.12 R 5.12 X 5.12+ 5.12+ PG13 5.12+ R 5.12a
## 8 1 385 6 2 3816
## 5.12a PG13 5.12a R 5.12a X 5.12a/b 5.12a/b PG13 5.12a/b R
## 64 11 1 526 9 2
## 5.12a/b X 5.12b 5.12b PG13 5.12b R 5.12b/c 5.12b/c PG13
## 1 2685 36 8 459 11
## 5.12c 5.12c PG13 5.12c R 5.12c X 5.12c/d 5.12c/d PG13
## 2012 20 6 1 238 2
## 5.12c/d R 5.12d 5.12d PG13 5.12d R
## 1 1374 15 4
# This category has the expected values.
# Checking 5.13 category to make sure only routes with 5.13 are contained in the group.
table(Sport_Routes$Rating[Sport_Routes$Difficulty == "5.13"])
##
## 5.13 5.13- 5.13- PG13 5.13- R 5.13 PG13 5.13+
## 237 200 2 3 1 104
## 5.13+ PG13 5.13+ R 5.13a 5.13a PG13 5.13a R 5.13a/b
## 2 1 1581 17 1 154
## 5.13a/b PG13 5.13b 5.13b PG13 5.13b R 5.13b/c 5.13b/c PG13
## 5 881 6 2 122 1
## 5.13c 5.13c PG13 5.13c/d 5.13c/d PG13 5.13d 5.13d PG13
## 539 6 61 1 355 2
## 5.13d R
## 1
# This category has the expected values.
# Checking 5.14 category to make sure only routes with 5.14 are contained in the group.
table(Sport_Routes$Rating[Sport_Routes$Difficulty == "5.14"])
##
## 5.14 5.14- 5.14- PG13 5.14+ 5.14a 5.14a PG13 5.14a/b
## 46 56 2 13 291 2 21
## 5.14b 5.14b PG13 5.14b/c 5.14c 5.14c/d 5.14d
## 117 2 15 45 3 25
# This category has the expected values.
# Checking 5.15 category to make sure only routes with 5.15 are contained in the group.
table(Sport_Routes$Rating[Sport_Routes$Difficulty == "5.15"])
##
## 5.15 5.15- 5.15+ 5.15a 5.15d
## 6 2 1 4 2
# This category has the expected values.
Sport_Routes_Updated <- filter(Sport_Routes, Difficulty %in% c("5.9", "5.10", "5.11", "5.12", "5.13", "5.14", "5.15"))
# Checking new updated difficulty variable.
table(Sport_Routes_Updated$Difficulty)
##
## 5.10 5.11 5.12 5.13 5.14 5.15 5.9
## 17376 16955 12784 4285 638 15 6778
# This variable contains expected categories.
summary(Sport_Routes_Updated$Avg.Stars)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## -1.000 2.000 2.700 2.599 3.000 4.000
# There are -1 ratings. Will check how many using table function.
table(Sport_Routes_Updated$Avg.Stars)
##
## -1 0 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6
## 545 170 22 6 83 17 59 62 32 1758 60 130 461 253 1054 520
## 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3 3.1 3.2
## 898 1128 791 7430 1218 1418 2744 2183 3686 2409 2772 2806 1725 8269 1500 1292
## 3.3 3.4 3.5 3.6 3.7 3.8 3.9 4
## 1708 1247 1966 1081 1084 961 608 2675
# A Negative 1 rating on mountain project means there was no rating for that climb.
# This doesn't mean that climb is actually receiving a negative rating.
# 0 would be the lowest rating. 4 would be the max, and -1 would mean no rating.
# -1 climbs will be included in the bar plots, but removed from the average rating custom cognostic.
Sports_Routes_Top_10_Locations <- Sport_Routes_Updated %>% # Passing Sport_Routes_Updated Data to next functions.
group_by(Location) %>% # Grouping routes by location.
summarise(Route_Count = n()) %>% # Counting routes at each location.
arrange(desc(Route_Count)) %>%
head (10) # Limits the new data set to the first 10 locations.
# Viewing data set.
View(Sports_Routes_Top_10_Locations)
# The top 10 locations are visible, but there aren't the other columns from the original data set.
# Will need to create a new data set with the Sports_Routes_Updated filtered by these 10 locations.
Sport_Routes_Top_10 <- Sport_Routes_Updated %>% # Passing Sports_Routes_Updated to filter function.
filter((Location %in% Sports_Routes_Top_10_Locations$Location)) # Filtering out only the locations in the top 10 locations data frame.
# Viewing updated data set to verify average star and difficulty are present.
View(Sport_Routes_Top_10)
# All observations are included as expected.
# Checking structure of data frame to make sure all 799 observations were maintained.
str(Sport_Routes_Top_10)
## 'data.frame': 799 obs. of 12 variables:
## $ X : int 24510 24511 24518 24519 24522 24523 24524 24525 24526 24528 ...
## $ Route : chr "Soap on a Rope" "Fugitive" "Whipping Boy" "Cuckoo's Nest" ...
## $ Location : chr "Jailhouse Rock > Sonora Pass Highway (108) > California" "Jailhouse Rock > Sonora Pass Highway (108) > California" "Jailhouse Rock > Sonora Pass Highway (108) > California" "Jailhouse Rock > Sonora Pass Highway (108) > California" ...
## $ URL : chr "https://www.mountainproject.com/route/107180419/soap-on-a-rope" "https://www.mountainproject.com/route/107491174/fugitive" "https://www.mountainproject.com/route/107840043/whipping-boy" "https://www.mountainproject.com/route/107180430/cuckoos-nest" ...
## $ Avg.Stars : num 3.7 3.8 3.4 2.5 3.6 3.6 3.8 3.8 3.6 4 ...
## $ Route.Type : chr "Sport" "Sport" "Sport" "Sport" ...
## $ Rating : chr "5.13a" "5.13a" "5.12b" "5.11d" ...
## $ Pitches : int 1 1 1 1 1 1 1 1 1 1 ...
## $ Length : int 100 70 65 90 90 80 95 80 100 NA ...
## $ Area.Latitude : num 37.9 37.9 37.9 37.9 37.9 ...
## $ Area.Longitude: num -121 -121 -121 -121 -121 ...
## $ Difficulty : chr "5.13" "5.13" "5.12" "5.11" ...
# Using the mutate and sub functions to make the location names shorter by removing the first > symbol and everything after it.
Sport_Routes_Top_10 <- Sport_Routes_Top_10 %>% # Using a pipe operator to pass the Top 10 Sport Route location's data to the function below.
mutate(Location = sub(" >.*", "", Location)) # Changing the location variable to just include the first name (the specific climbing area).
Nest_Sport_Routes_Top_10 <- Sport_Routes_Top_10 %>% # Creating a nest data frame of the top 10 data set.
group_by(Location) %>% # Creating separate groups for each location.
nest() # Creating a column that contains the data from Sports_Routes_Top_10 for each location.
# Creating a bar plot for each location.
Nest_Sport_Routes_Top_10 <- Nest_Sport_Routes_Top_10 %>% # Updating the data frame with a plot column from the following code.
mutate(plots = map_plot(data, function (x) { # Creating a new variable called plots that loops through the data with the next function.
ggplot(data = x, aes(x = factor(Difficulty, # Using the data frames for each location as the data and difficulty on the x axis.
levels = c("5.9", "5.10", "5.11", "5.12", "5.13", "5.14", "5.15")))) + # Ensuring the plots are ordered by difficulty.
geom_bar() + # Creating bar plots.
labs(title = "Climbing Difficulty Count by Grade",# Adding Title.
x = "Grade Difficulty",
y = "# of Routes") +
theme(plot.title = element_text(hjust = 0.5),
axis.text = element_text(size = 7))
})) # Creates bar plots for each difficulty distribution in each top 10 location.
# Creating the custom cognostic so the plots only include locations with an average star greater than or equal to 2.5.
Nest_Sport_Routes_Top_10 <- Nest_Sport_Routes_Top_10 %>% # Creating a new variable with the average rock climbing rating for each location.
mutate(Avg_Star_Rating = map_dbl(data, function(x) { # Using the data from the data columns and pulling the Avg_Star_Rating column specifically.
mean(x$Avg.Stars[x$Avg.Stars != -1], na.rm = TRUE) # Calculating the average and omitting the -1 values which aren't actual ratings.
}))
Nest_Sport_Routes_Top_10 %>% # Passing top ten route data.
ungroup() %>% # Removing groups from nested data set before creating interactive Trelliscope display.
trelliscope(name = "All Locations", # Calling the name "All Locations" for the first set of panels.
path = "t5", # Shortening path name to resolve knitting issue.
self_contained = TRUE) # Adding self contained to address rpubs publishing issue.
Nest_Sport_Routes_Top_10 %>% # Passing top ten route data.
ungroup() %>% # Removing groups from nested data set before creating interactive Trelliscope display.
filter(Avg_Star_Rating >= 2.5) %>% # Filtering by just locations with an average star rating >=2.5.
trelliscope(name = "Top Rated Locations", # Calling this set of panels the Top Rated Locations.
path = "t6", # Shortening path name to resolve knitting issue.
self_contained = TRUE) # Adding self contained to address rpubs publishing issue.
The Mountain Project data set containing rock climbing routes in the United States was chosen for this project to create an interactive trelliscope display of bar plots with the climbing difficulty distributions for the 10 locations with the most sport climbing routes. The necessary information to create these bar plots was obtained from the location variable and the rating variable (grouped into the difficulty variable).
Additionally, the data set contains an average star rating (per climb), which provides insights about how favorable climbers found specific routes on average. This variable was utilized to create a custom cognostic of the average star rating for all the climbs at each of the top 10 locations. Then, another interactive trelliscope display was created to visualize which of the 10 locations with the most sport routes also have an average star rating >=2.5.
The Mountain Project data set required some data preparation before the interactive trelliscope displays could be created. First, the ratings variable had multiple description types for the same climbing difficulty. For instance, a 5.11 was also referred to as 5.11-. Also, there are just a lot of climbing grades without even counting the duplicates.
A large number of grades would make it difficult to plot the grade ranges. For example, an area might have a lot of 5.11a routes and very few 5.11b routes. The 5.11b routes are just a little more difficult than the 5.11a routes. Plotting the distribution for all of these specific grades would create situations where two grades in a similar range have drastically different bar heights, making it difficult for a climber to view the distributions for the grades at their level. It would also make the graph congested without adding much value. As such, I decided to create a new difficulty variable from the rating variable and consolidated the grades into the more common ranges: 5.9, 5.10, 5.11, 5.12, 5.13, 5.14, and 5.15.
Another data preparation challenge was that the average star rating (per climb) variable had a range of -1 to 4. -1 wasn’t actually a poor rating, but the absence of one. I identified this issue in the data preparation section by reviewing the summary statistics for this variable, but this obstacle was actually addressed by omitting the routes rated -1 from the custom cognostic calculation referenced earlier.
The first interactive trelliscope display provided the intended information, creating a visual tool climbers could use to identify which locations with the most sport routes have climbing grades at their level.
For example, an elite climber will probably want to climb at the Jailhouse Rock location since there are over 20 5.14 routes and nearly 60 5.13 routes. Notably, there were no 5.15 grades at any of these locations. There aren’t many climbs in general at that level, so it’s not a surprise none of them were present after filtering the top 10 locations. Nonetheless, 5.14 climbs are very difficult and will provide elite climbers with a good option. The Killer Cave could also be a good option for elite climbers.
On the other hand, less experienced climbers may prefer the Quarry Wall at the Bank, Spring Mountain, or the Penitente - Inner Canyon locations, since there are a lot of 5.9 and 5.10 climbs at those locations.
More advanced climbers (not elite) would probably enjoy going to The Dark Side, Contest Wall, or the Gym Locations, since there are a lot of 5.10 to 5.12 routes there.
Lastly, the most balanced locations are the Chocolate Factory and the World Wall with an appreciable number of climbs between 5.10 and 5.14. Everyone besides new climbers could find something at those locations.
The second interactive trelliscope display only included locations with an average star rating >=2.5. After applying this filter, the Contest Wall, the Penitente - Inner Canyon, and the Quarry Wall at the Bank were removed from the new display. That means climbers may want to reconsider going to these areas because the climbs there were rated lower on average compared to other locations. This affects the least experienced climbers the most since that’s two of the three best options for them. Advanced climbers may also have to reconsider the Contest Wall since those climbs have lower ratings.
In summary, the two interactive trelliscope displays successfully created visual aids for climbers to quickly identify which locations from Mountain Project have the most sport routes, what the grade distributions are for those locations, and which of them have highly rated climbs. This information will provide assistance to climbers when choosing their climbing destinations.