<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/finding-radioheads-most-depressing-song-with-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2017/02/finding-radioheads-most-depressing-song-with-r.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p><a target="_blank" rel="nofollow" href="https://www.radiohead.com/">Radiohead</a> is known for having some fairly maudlin songs, but of all of their tracks, which is the <em>most</em> depressing? Data scientist and R enthusiast Charlie Thompson <a target="_blank" rel="nofollow" href="http://rcharlie.com/2017-02-16-fitteR-happieR/">ranked all of their tracks according to a &quot;gloom index&quot;</a>, and created the following chart of gloominess for each of the band's nine studio albums. (Click for the <a target="_blank" rel="nofollow" href="http://rcharlie.com/htmlwidgets/fitterhappier/album_chart.html">interactive version</a>, crated with with <a target="_blank" rel="nofollow" href="https://mran.revolutionanalytics.com/package/highcharter/">highcharter package for R</a>, which allows you to explore individual tracks.)</p>
<p><a target="_blank" rel="nofollow" href="http://rcharlie.com/htmlwidgets/fitterhappier/album_chart.html"><img title="Radiohead sad songs" alt="Radiohead sad songs" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c8d8a72c970b-800wi" border="0"></a></p>
<p>If you're familiar with the albums, this looks pretty reasonable. Radiohead's debut, &quot;Honey Pablo&quot; was fairly poppy musically, but contained some pretty dark lyrics (especially in the break-out hit, <em>Creep</em>). Their most recent album &quot;A Moon Shaped Pool&quot; is a fantastic listen, but it isn't exactly going to get the party started. </p>
<p>The &quot;Gloom Index&quot; charted above is a combination of three quantities, and then scaled from 1 (Radiohead's gloomiest song, <em>True Love Waits</em>), to 100 (the cheeriest, <em>15 Step</em>).</p>
<p>The first quantity is Spotify's &quot;<a target="_blank" rel="nofollow" href="https://developer.spotify.com/web-api/get-audio-features/">valence score</a>&quot;, which Spotify describes as a &quot;quantity describing the musical positiveness of a track&quot;. Valence scores range from 0 (songs that sound depressed or angry) to 1 (songs that are happy or euphoric). Charlie extracted the list of Radiohead's 101 singles and the valence score for each from the Spotify developer API, using the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/httr/">httr package</a> for R. This is useful in its own right, but several songs have the same valence score, so Charlie also looks at song lyrics to further differentiate them.</p>
<p>The second quantity is the percentage of words in the lyrics that that are &quot;sad&quot;. Charlie scraped the song lyrics from <a target="_blank" rel="nofollow" href="https://genius.com/">Genius</a> using the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/rvest/">rvest package</a>, and then used the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/tidytext/">tidytext package</a> to break the lyrics into words, eliminate common &quot;stop words&quot; like 'the' and 'a', and count the number with negative sentiment.</p>
<p>The third quantity is the &quot;lyrical density&quot; (<a target="_blank" rel="nofollow" href="http://www.everydayanalytics.ca/2013/06/radiohead-lyrics-data-visualization-and-content-analysis.html">following a method described by Myles Harrison</a>): the number of words per second, easily calculated from the Spotify track length data and the word counts calculated in the prior step.</p>
<p>The three quantities are combined together to create the &quot;gloom index&quot; as follows:</p>
<p>$$ \mathrm{gloomIndex} = \frac{1-\mathrm{valence}}{2} + \frac{\mathrm{pctSad}*(1+\mathrm{lyricalDensity})}{2} $$</p>
<p>Roughly, this is the average of the valence score and (almost) the number of sad words per second. (I'm guessing Charlie adds 1 to the lyrical density to get the two terms to about the same scale, so that both have about equal weight.)</p>
<p>It would be interesting to compare the &quot;Gloom Index&quot; for Radiohead with that for other famously downbeat artists (say, Bon Iver or Low). You'd need to so away with scaling the Gloom Index from 1 to 100 as Charlie has done here, but the formula could easily be adapted to make a universal score. If you'd like to give it a try, all of the R code is included in Charlie's blog post, linked below.</p>
<p>RCharlie: <a target="_blank" rel="nofollow" href="http://rcharlie.com/2017-02-16-fitteR-happieR/">fitteR happieR</a></p>
<p> </p>
</div>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2017/02/finding-radioheads-most-depressing-song-with-r.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/Ew7zY0L_Er4"></a></div>