Mapping the Vikings using R

April 3, 2019

(This article was first published on R – What You're Doing Is Rather Desperate, and kindly contributed to R-bloggers)

The commute to my workplace is 90 minutes each way. Podcasts are my friend. I’m a long-time listener of In Our Time and enjoyed the recent episode about The Danelaw.

Melvyn and I hail from the same part of the world, and I learned as a child that many of the local place names there were derived from Old Norse or Danish. Notably: places ending in -by denote a farmstead, settlement or village; those ending in -thwaite mean a clearing or meadow.

So how local are those names? Time for some quick and dirty maps using R.

First, we’ll need a dataset of British place names. There are quite a few of these online, but top of my Google search was Index of Place Names in Great Britain (July 2016). It comes in several formats including CSV, easy to read into R like so:


gbplaces <- read_csv("")

A quick inspection of the data reveals that whilst there is a unique identifier, objectid_1, each row is not as such a unique place (the dataset is based on grid locations). We can reduce the number of rows a little by taking distinct(placesort, lat, long_), but that will still retain duplicate place names with slightly different coordinates. For our purposes, it doesn’t really matter – we just want an indication of distribution, rather than a highly-accurate map.

We’ll start by looking at places ending in -by. For this example, we’ll let the points themselves define the outline of Great Britain rather than drawing one. We’ll emphasise the -by places and try to de-emphasise the rest.

gbplaces %>% 
  distinct(placesort, lat, long_) %>% 
  mutate(isBy = ifelse(grepl("^.+by$", placesort), TRUE, FALSE)) %>% 
  # not the territories!
  filter(lat > 40) %>% 
  ggplot(aes(long_, lat)) + 
  geom_point(aes(color = isBy, 
                 alpha = isBy), 
             size = 0.5) + 
  scale_colour_viridis_d(direction = -1, 
                         name = "ends in -by", 
                         option = "inferno") + 
  scale_alpha_manual(values = c(0.3, 1)) + 
  theme(axis.title = element_blank(), 
        axis.text = element_blank(), 
        axis.ticks = element_blank(),
        panel.grid = element_blank(),
        panel.border = element_blank()) + 
  labs(title = "Distribution of GB place names ending -by") + 
  guides(alpha = FALSE) +

Here’s the result – click for a larger version. Not bad. Lots of locations in Cumbria and eastern England. I like how the “plotting by points only” approach emphasises the empty mountainous regions in Scotland, Northern England and Wales.

Now we’ll look at -thwaite. This time we’ll use map_data() to pull an outline from the maps package.

# filter out N Ireland
ggplot(data = map_data("world", "UK") %>% filter(group != 3), 
       aes(x = long, y = lat)) +
geom_polygon(aes(group = group), 
             fill = "darkolivegreen") +
coord_map() +
geom_point(data = gbplaces %>% filter(grepl("^.+thwaite$", placesort), 
                                      lat > 40), 
           aes(long_, lat), 
           color = "yellow", 
           size = 0.5) + 
  theme(axis.title = element_blank(), 
        axis.text = element_blank(), 
        axis.ticks = element_blank(),
        panel.grid = element_blank(),
        panel.border = element_blank()) + 
  labs(title = "Distribution of GB place names ending -thwaite")

Result below. We see that -thwaite is much more localised to Cumbria and parts of Yorkshire.

I find mapping languages quite fascinating, but of course it’s not an original idea. Here’s an interactive map of Norse-derived place names in the UK, developed for an exhibition at the British Museum. I’m sure there are many others.

If you want to put data on a map, R offers many options using base R, ggplot2 or interactive Javascript such as Leaflet. I think it’s never been quicker or easier to do.

To leave a comment for the author, please follow the link and comment on their blog: R – What You're Doing Is Rather Desperate. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


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)