Create a word cloud of the names of your sex from the year you were born.
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 ="circle", color ="pink") # generate the word cloud
Graph its popularity over time.
babynames |># start with the datafilter(name =="Hailey", 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 ="green") # make it a line graph and give the line a color
Create a table showing which years it was most popular.
babynames |># Start with the datasetfilter(name =="Hailey", sex =="F") |># only look at the name and sex you wantslice_max(prop, n =10) # get the top 10 names
# A tibble: 10 × 5
year sex name n prop
<dbl> <chr> <chr> <int> <dbl>
1 2003 F Hailey 8793 0.00438
2 2004 F Hailey 8683 0.00431
3 2005 F Hailey 8589 0.00423
4 2001 F Hailey 8030 0.00406
5 2002 F Hailey 7991 0.00405
6 2006 F Hailey 8421 0.00403
7 2007 F Hailey 8433 0.00399
8 2000 F Hailey 7831 0.00393
9 2008 F Hailey 7866 0.00378
10 2009 F Hailey 7314 0.00362
Graph its popularity in comparison to another name or two.
babynames |>filter(name =="Hailey"| name =="Ellie"| name =="Terran") |>filter(sex =="F") |>filter(year >2000) %>%ggplot(aes(x = year, y = n, color = name)) +geom_line()
Select a few famous people’s names from different time periods. Graph their pattern of popularity over time.
From the first graph above, it shows that the name JOhnny hit its peak in about the 1950s. We can see from this graph directly above that there was a spike in about 2007 and again in 2013. There were films made in 2007 and 2011.