Tidy Tuesday – Looking at Scottish Munros

[This article was first published on John Russell, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Getting back Into It

It’s been a while for this website; a lot of my work has been used on projects that can’t be easily shared here. That said, I have been at the Edinburgh Fringe this month supporting my wife, and I wanted to use a Tidy Tuesday dataset to refresh some skills.

Loading necessary packages and the data

Code in R
library(tidyverse)
library(sf)
library(rnaturalearth)
library(ggview)

tuesdata <- tidytuesdayR::tt_load(2025, week = 33)

scottish_munros <- tuesdata$scottish_munros

Getting a base map of Scotland, with some bodies of water

The first thing we will need is a map of scotland, and to see if we can put any major bodies of water in it. We can use the rnaturalearth package for this, with the caveat that bodies of water have to be pretty large for it them to show up!

Code in R
scotland <- ne_countries(geounit = "scotland", type = "map_units", scale="large")

water <- ne_download(scale=10, type="lakes", category="physical")
Reading layer `ne_10m_lakes' from data source 
  `C:\Users\russe\AppData\Local\Temp\Rtmp2dZUJn\ne_10m_lakes.shp' 
  using driver `ESRI Shapefile'
Simple feature collection with 1355 features and 41 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: -165.9656 ymin: -50.66967 xmax: 177.1544 ymax: 81.95521
Geodetic CRS:  WGS 84
Code in R
river <- ne_download(scale=10, type="rivers_lake_centerlines", category="physical")
Reading layer `ne_10m_rivers_lake_centerlines' from data source 
  `C:\Users\russe\AppData\Local\Temp\Rtmp2dZUJn\ne_10m_rivers_lake_centerlines.shp' 
  using driver `ESRI Shapefile'
Simple feature collection with 1473 features and 38 fields
Geometry type: MULTILINESTRING
Dimension:     XY
Bounding box:  xmin: -164.9035 ymin: -52.15775 xmax: 177.5204 ymax: 75.79348
Geodetic CRS:  WGS 84

Now that we have rivers and lakes, we can us the sf package to provide a filter that just looks for rivers and lakes that are within the scotland shapefile’s latitude and longitude.

Code in R
sf_use_s2(FALSE)

waterscotland <- st_filter(water,scotland)
riverscotland <- st_filter(river, scotland)

Working across coordinate systems

In the Tidy Tuesday dataset, the Scottish Munros are in British National Grid (OSGB36, or CRS 27700), which is a coordinate system based on meters eastward and northward from a point outside of the Southern and Westernmost point of Britain (ignoring Northern Island).

Because our geometry is standard World Geodetic System, it is easiest to translate to this system (CRS 4326). Finally, we should pull the coordinates for plotting.

Code in R
projection <- st_as_sf(scottish_munros |> 
                         filter(!is.na(xcoord),
                                !is.na(ycoord)),
                       coords=c("xcoord","ycoord"),
                       crs = 27700) |> 
  st_transform(crs=4326) |> 
  st_coordinates()

scottish_munros <- scottish_munros |> 
  filter(!is.na(xcoord)) |> 
  cbind(projection)

Making our map

We now have everything to make our map. I take advantage of ggview for outputting this, with that code in comments.

Code in R
map <- scotland |> 
  ggplot() +
  geom_sf() +
  geom_sf(data=waterscotland, fill="blue") +
  geom_sf(data=riverscotland, color="blue") +
  geom_point(data=scottish_munros |> 
               filter(!is.na(`2021`)), 
             aes(x=X, y=Y, color=`2021`),shape="^", size=3) +
  theme_light() +
  coord_sf(xlim=c(-10,0)) +
  scale_color_brewer(palette="Dark2", direction=-1) +
  labs(color="",
       title="Munros of Scotland, as classified in 2021",
       subtitle="Effect of the Great-Glen Fault",
       caption="TidyTuesday") +
  theme(legend.position="bottom",
        legend.margin=margin(0,0,0,0),
        plot.title.position="plot",
        axis.title = element_blank(),
        panel.background = element_rect(fill="lightblue"),
        legend.key = element_rect(fill = NA))

map

Code in R
# map + canvas(width=4.5, height=4.5, units="in")

# ggsave(map, width=4.5, height=4.5, units="in", filename="img/scotlandmap.png")

Citation

BibTeX citation:
@online{russell2025,
  author = {Russell, John},
  title = {Tidy {Tuesday} - {Looking} at {Scottish} {Munros}},
  date = {2025-08-20},
  url = {https://drjohnrussell.github.io/posts/2025-08-20-Scottish-Munros/},
  langid = {en}
}
For attribution, please cite this work as:
Russell, John. 2025. “Tidy Tuesday - Looking at Scottish Munros.” August 20, 2025. https://drjohnrussell.github.io/posts/2025-08-20-Scottish-Munros/.
To leave a comment for the author, please follow the link and comment on their blog: John Russell.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)