- "markdown": "---\ntitle: \"How are we feeling: A Severance Analysis\"\nauthor: \"Lucy D'Agostino McGowan\"\ndate: \"2025-02-20\"\ncategories: [\"rstats\", \"severance\", \"data visualization\"]\ndescription: \"We create a little sentiment profile for each episode, binning them in three minute increments and calculating the AFINN average sentiment score in each. \"\n---\n\n\n\n\nThis analysis was made possible by the [mdr](https://lucymcgowan.github.io/mdr) R package, which used data originally compiled by [the Severance wiki](https://severance.wiki/). Here, we create a little sentiment profile for each episode, binning them in three minute increments and calculating the AFINN average sentiment score in each. \n\n\n\n\n::: {.cell layout-align=\"center\"}\n\n```{.r .cell-code code-fold=\"true\"}\nlibrary(tidytext)\nlibrary(mdr)\nlibrary(tidyverse)\n\ndf <- transcripts |>\n mutate(timestamp_seconds = as.numeric(timestamp), \n bin = floor(timestamp_seconds / 180) * 180) |>\n left_join(episodes, by = c(\"season\", \"episode\"))\n\ndf |>\n mutate(id = glue::glue(\"Season {season} Episode {episode}\\nWritten by: {writer}\")) |>\n unnest_tokens(word, dialogue) |>\n inner_join(get_sentiments(\"afinn\"), by = \"word\") |>\n group_by(id, bin) |>\n summarise(sentiment = mean(value)) |>\n ggplot(aes(x = bin, y = sentiment, fill = sentiment > 0)) + \n geom_bar(stat = \"identity\", alpha = 0.8) +\n scale_fill_manual(values = c(\"#C15C58\", \"#5BA9D0\")) +\n scale_x_time(labels = scales::time_format(\"%M:%S\")) +\n labs(x = \"\") +\n facet_wrap(~id, ncol = 3) + \n theme_mdr() + \n theme(\n strip.text = element_text(size = 8),\n legend.position = \"none\",\n panel.grid.minor = element_blank(),\n panel.grid.major = element_blank())\n```\n\n::: {.cell-output-display}\n{fig-align='center' width=960}\n:::\n:::\n\n\n\n\n\n*This post was originally posted on my Severance themed site [[found here](https://mdr.lucymcgowan.com/analysis-whos-talking/)]*.\n",
0 commit comments