This is how popular my name was the year I was born. It was the second highest baby girl’s name that year.
babynames |>filter(year ==2003) |># use only one yearfilter(sex =="F") |># use only one sexslice_max(prop, n=100) |># use the top 100 namesselect(name, n) |># select the two relevant variables: the name and how often it occurswordcloud2(size = .5, shape ="square", color ="red") # generate the word cloud
This is a word cloud of all the most popular girls’ names the year I was born (the larger the word, the more popular the name). Emma is pretty big, meaning it’s pretty popular.
babynames |># start with the datafilter(name =="Emma", sex =="F") |># choose the name and sexmutate(percent =round(prop *100, 1)) |># create a new variable called percentggplot(aes(x = year, y = percent)) +# put year on the x-axis and prop (proportion) on ygeom_line(color ="pink") # make it a line graph and give the line a color
This is a graph of my name’s popularity over time. It started high, went down, and picked back up again around the start of this century.
babynames |># Start with the datasetfilter(name =="Emma", sex =="F") |># only look at the name and sex you wantslice_max(prop, n =10)
# A tibble: 10 × 5
year sex name n prop
<dbl> <chr> <chr> <int> <dbl>
1 1881 F Emma 2034 0.0206
2 1880 F Emma 2003 0.0205
3 1882 F Emma 2303 0.0199
4 1883 F Emma 2367 0.0197
5 1885 F Emma 2728 0.0192
6 1884 F Emma 2587 0.0188
7 1886 F Emma 2764 0.0180
8 1887 F Emma 2647 0.0170
9 1888 F Emma 3087 0.0163
10 1889 F Emma 2884 0.0152
This is a table of the years over time that my name has been most popular, arranged by the proportion of how popular it was (right column).
babynames |>filter(name =="Emma"| name =="Laura"| name =="Kameron") |>filter(sex =="F") |>ggplot(aes(x = year, y = n, color = name)) +geom_line()
This is the popularity of my name over time as compared to Laura and Dr. K’s. I am the red line.
babynames |>filter(name =="Andrew"| name =="Tobias"| name =="Thomas") |>filter(sex =="M") |>ggplot(aes(x = year, y = n, color = name)) +geom_line()
This is the popularity of the three Spiderman actors’ names over time. As far as I could surmise, the popularity of their movies didn’t change the popularity of their names.