A baby named Al*

[This article was first published on R – scottishsnow, 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.

About half the males in my team seem to be called Alasdair, but few of them spell it the same way. I live in hope the The International Organization for Standardization will fix the spelling, I can’t believe it hasn’t been higher up their agenda.

Anyhoo, here’s a quick post about baby names using National Records of Scotland data and a wee bit of R magic to tidy and visualise.


df = read_csv("Downloads/babies-first-names-18-vis-final.csv")

# https://en.wikipedia.org/wiki/Alistair
var = c("Alasdair", "Alistair", "Alastair", "Allister", "Alister", "Aleister")

png("Downloads/a_baby_named_Al.png", height = 800, width = 1200)
df %>%
  gather(year, count, -firstname, -sex) %>%
  filter(sex == "Male") %>%
  filter(firstname %in% var) %>%
  mutate(year = as.numeric(year)) %>%
  ggplot(aes(year, count, colour = firstname)) +
  geom_line(lwd = 2) +
  scale_color_brewer(type = "qual", palette = "Set1") +
  labs(title = "Popularity of Al baby names",
      subtitle = "Created by Mike Spencer @mikerspencer\nNational Records of Scotland data:\nhttps://www.nrscotland.gov.uk/news/2018/most-popular-names-in-scotland",
      x = "Year",
      y = "Named babies",
      colour = "") +
  theme_bw() +
  theme(text = element_text(size = 30),
        plot.subtitle = element_text(size = 14))

Here’s the output!


To leave a comment for the author, please follow the link and comment on their blog: R – scottishsnow.

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)