Kaitlin Kavlie, PSYC 541

  1. This will determine rank in popularity for the name ‘Kaitlin’ among girls in the year 1998.

babynames %>%                             
  filter(year == 1998, sex == "F") %>%    
  mutate(rank = row_number()) %>%         
  mutate(percent = round(prop * 100, 1)) %>% 
  filter(name == "Kaitlin")               
NA

The results of the analysis show that the name ‘Kaitlin’ was ranked 120th in the year 1998 and a total of 2,701 individuals were given that name in 1998, 0.1% of the female population born that year.

  1. This will create a word cloud of the top 100 female names in 1998.
babynames %>%
  filter(year == 1998) %>%     # use only one year
  filter(sex == "F") %>%       # use only one sex
  select(name, n) %>%          # select the two relevant variables: the name and how often it occurs
  top_n(100, n) %>%            # use only the top names or it could get too big
  wordcloud2(size = .5)        # generate the word cloud at a font size of .5

The wordcloud created shows the 100 most popular female names in the year 1998, the more popular a name the larger the font of the name.

  1. This will create a graph of the name ‘Kaitlin’ and it’s popularity over time.
babynames %>%
  filter(name == "Kaitlin", sex == "F") %>% 
  ggplot(aes(x = year, y = n)) +
  geom_line()

The analysis of the results show no one had the name ‘Kaitlin’ until after 1970 and the name peaked in the year 1995 and has continued to decline in popularity.

  1. This will create a table showing the years the name ‘Kaitlin’ was most popular.
babynames %>%                                  # Start with the dataset
  filter(name == "Kaitlin", sex == "F") %>%    # only look at the name and sex you want
  top_n(10, prop) %>%                          # get the top 10 names
  arrange(-prop)                               # sort in descending order

The results of the analysis show that the name ‘Kaitlin’ was most popular in 1995, and heavily popular in the decade of the 1990s, with the exclusion of the year 1998 and 1999. It was also popular in the years 1988 and 1989.

  1. This will create a graph of the name ‘Kaitlin’ and it’s popularity in comparison to the names ‘Katherine’ and ‘Allison’ of the same sex.
babynames %>%
  filter(name == "Kaitlin" | name == "Katherine" | name == "Allison") %>% 
  filter(sex == "F") %>% 
  ggplot(aes(x = year, y = n, color = name)) +
  geom_line()

The results of the analysis and show the name ‘Katherine’ has overall been the most popular of the 3 names. While ‘Allison’ has been the second popular of the 3 names, and ‘Kaitlin’ has been the least popular of the 3 names.

LS0tDQp0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