library(tidyverse)
library(plotly)
library(leaflet)
expeditions <- read_csv("expeditions.csv")
peaks <- read_csv("himalayan_peaks.csv")
expeditions <- expeditions |>
left_join(
peaks |>
select(PEAKID, PKNAME),
by=join_by(PEAKID))
most_pop_yearly <- expeditions |>
group_by(YEAR, PKNAME) |>
count() |>
ungroup() |>
group_by(YEAR) |>
slice_max(n, n=4) |>
mutate(
YEAR = as.factor(YEAR)
) |>
rename(
Expeditions = n
)
most_pop_yearly$YEAR <- factor(most_pop_yearly$YEAR, levels = c("2024", "2023", "2022", "2021", "2020"))
plot <- most_pop_yearly |>
ggplot(aes(x = Expeditions,
y = PKNAME,
fill = YEAR)) +
geom_bar(stat = "identity") +
labs(
x = "Number of Expeditions",
y = "Peak Name",
title = "Yearly Expeditions to Himalayan Peaks",
fill = "Year"
) +
scale_fill_viridis_d(option = "C", end = 0.8) +
theme_minimal()
ggplotly(plot, tooltip = "x")
leaflet() |>
addTiles() |>
addPopups(lng = 84.5597,
lat = 28.5497,
popup = "Manaslu"
) |>
addPopups(lng = 87.0876,
lat = 27.8857,
popup = "Makalu"
) |>
addPopups(lng = 86.9336,
lat = 27.9626,
popup = "Lhotse"
) |>
addPopups(lng = 84.416667,
lat = 28.735,
popup = "Himlung Himal"
) |>
addPopups(lng = 86.9250,
lat = 27.9881,
popup = "Everest"
) |>
addPopups(lng = 86.8612,
lat = 27.8619,
popup = "Ama Damblam"
)