Skip to content

Commit a5fe09c

Browse files
committed
add code
1 parent 3f2eb7c commit a5fe09c

File tree

4 files changed

+4
-8
lines changed
  • _freeze/posts
    • 2025-02-20-how-are-we-feeling-a-severance-analysis/index/execute-results
    • 2025-03-20-elevator-ding/index/execute-results
  • posts
    • 2025-02-20-how-are-we-feeling-a-severance-analysis
    • 2025-03-20-elevator-ding

4 files changed

+4
-8
lines changed

_freeze/posts/2025-02-20-how-are-we-feeling-a-severance-analysis/index/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"hash": "36d3cff10c91fb5c66659132a2721b87",
2+
"hash": "ca18b802c5f72166e9d04403f6c0cb27",
33
"result": {
44
"engine": "knitr",
5-
"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![](index_files/figure-html/unnamed-chunk-1-1.png){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-feeling-over-time/)]*.\n",
5+
"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}\n\n```{.r .cell-code}\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![](index_files/figure-html/unnamed-chunk-1-1.png){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-feeling-over-time/)]*.\n",
66
"supporting": [
77
"index_files"
88
],

_freeze/posts/2025-03-20-elevator-ding/index/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

posts/2025-02-20-how-are-we-feeling-a-severance-analysis/index.qmd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ This analysis was made possible by the [mdr](https://lucymcgowan.github.io/mdr)
1111

1212

1313
```{r}
14-
#| code-fold: true
15-
#| fig-align: center
1614
#| fig-width: 10
1715
#| fig-height: 15
1816
#| message: false

posts/2025-03-20-elevator-ding/index.qmd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ This analysis was made possible by the [mdr](https://lucymcgowan.github.io/mdr)
1111

1212

1313
```{r}
14-
#| echo: false
1514
#| message: false
1615
#| warning: false
1716
#| fig-width: 20
@@ -65,5 +64,4 @@ ggiraph::girafe(ggobj = p)
6564

6665

6766

68-
6967
*This post was originally posted on my Severance themed site [[found here](https://mdr.lucymcgowan.com/analysis-elevator-dings/)]*.

0 commit comments

Comments
 (0)