library(babynames)
library(tidyverse)
library(plotly)
Names Based on Colors
US Babynames and Colors
Project aims to explore frequency with which parents made their children name their children after colors.
Our first step is to load the required packages.
Now lets load our external data, a .csv taken from here:
<- read_csv("colors.csv", col_names = FALSE) colors
Now we merge the two data sets togetherg.
colnames(colors) [2] <- "name"
|>
babynames inner_join(colors) -> color_names
Joining with `by = join_by(name)`
Lets visualize the 20 most popular color names overtime:
|>
color_names group_by(name) |>
summarize(total = sum(n)) |>
arrange(desc(total)) |>
head(20) -> popular_color_names
|>
babynames filter(name %in% popular_color_names$name) |>
ggplot(aes(year, prop, color = name)) + geom_line() +
facet_wrap(~sex) -> plot1
ggplotly(plot1)