Skip to content

Instantly share code, notes, and snippets.

@mine-cetinkaya-rundel
Created August 31, 2020 13:51
Show Gist options
  • Save mine-cetinkaya-rundel/605b71957abef31c5942466a480d7b89 to your computer and use it in GitHub Desktop.
Save mine-cetinkaya-rundel/605b71957abef31c5942466a480d7b89 to your computer and use it in GitHub Desktop.
Number of utterances of "you guys" from the Friends cast
library(friends) # devtools::install_github("EmilHvitfeldt/friends")
library(tidyverse)
you_guys <- friends %>%
mutate(text = tolower(text)) %>%
filter(str_detect(text, "you guys")) %>%
count(speaker, sort = TRUE)
you_guys
#> # A tibble: 70 x 2
#> speaker n
#> <chr> <int>
#> 1 Rachel Green 218
#> 2 Ross Geller 177
#> 3 Joey Tribbiani 175
#> 4 Phoebe Buffay 146
#> 5 Chandler Bing 85
#> 6 Monica Geller 81
#> 7 Amy Green 6
#> 8 Richard Burke 5
#> 9 Erica 4
#> 10 Janice Litman Goralnik 4
#> # … with 60 more rows
you_guys %>%
slice_head(n = 6) %>%
ggplot(aes(y = fct_reorder(speaker, n), x = n)) +
geom_col() +
theme_minimal() +
labs(
x = "",
y = "",
title = 'Number of utterances of "you guys" from the Friends cast'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment