Skip to content

Instantly share code, notes, and snippets.

@dalejbarr
Created September 9, 2016 13:40
Show Gist options
  • Select an option

  • Save dalejbarr/a1faee4c34f23406c625d7533500c9ac to your computer and use it in GitHub Desktop.

Select an option

Save dalejbarr/a1faee4c34f23406c625d7533500c9ac to your computer and use it in GitHub Desktop.

Revisions

  1. dalejbarr created this gist Sep 9, 2016.
    17 changes: 17 additions & 0 deletions scottish_babynames.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    library(dplyr)
    library(readr)
    library(ggplot2)

    dat <- read_csv("babies-first-names-all-names-all-years2.csv")

    # pull out babies born in 1998
    dat98 <- filter(dat, yr == 1998) %>%
    group_by(sex) %>%
    filter(rank <= 5)

    top10 <- semi_join(dat, dat98 %>% select(sex, FirstForename),
    c("sex", "FirstForename"))

    ggplot(top10, aes(yr, number, colour = FirstForename)) +
    geom_line() + facet_wrap(~sex)