<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/comparing-subreddits-with-latent-semantic-analysis-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2017/03/comparing-subreddits.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>FiveThirtyEight published a fascinating article this week <a target="_blank" rel="nofollow" href="https://fivethirtyeight.com/features/dissecting-trumps-most-rabid-online-following/">about the subreddits that provided support to Donald Trump</a> during his campaign, and continue to do so today. <a target="_blank" rel="nofollow" href="https://www.reddit.com/">Reddit</a>, for those not in the know, is an popular online social community organized into thousands of discussion topics, called subreddits (the names all begin with &quot;<code>r/</code>&quot;). Most of the subreddits are a useful forum for interesting discussions by like-minded people, and some of them are toxic. (That toxicity extends to some of the names, which is reflected in some of the screenshots below — apologies in advance.) The article looks at various popular and notorious subreddits and finds those that are most similar to the main subreddit devoted to Donald Trump and also to the main other contenders in the 2016 campaign for president, Hillary Clinton and Bernie Sanders.</p>
<p><a target="_blank" rel="nofollow" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01bb09872202970d-pi"><img title="Subreddits" alt="Subreddits" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01bb09872202970d-800wi" border="0"></a></p>
<p>The underlying method used to compare subreddits for this purpose is quite ingenious. It's based on a concept you might call &quot;subreddit algebra&quot;: you can &quot;add&quot; two subreddits and find a third that reflects the intersection of the two. (One example they give is adding <code>r/nba</code> to <code>r/minnesota</code> gives you <code>r/timberwolves</code>, the subreddit for Minnesota's NBA team.) The you can apply the same process to subtraction: if you remove all the posts like those in the mainstream <code>r/politics</code> site from those in <code>r/The_Donald</code> you're left with posts that look like those in several toxic subreddits.</p>
<p>The statistical technique used to identify posts that are &quot;similar&quot; to another is <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Latent_semantic_analysis">Latent Semantic Analysis</a>, and the article gives this nice illustration of using it to compare subreddits:</p>
<p><a target="_blank" rel="nofollow" href="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c8e3f20d970b-pi"><img title="LSA" alt="LSA" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c8e3f20d970b-800wi" border="0"></a></p>
<p>The analysis was performed in R, and the <a target="_blank" rel="nofollow" href="https://github.com/fivethirtyeight/data/tree/master/subreddit-algebra">code is available in GitHub</a>. The code makes heavy use of the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/lsa/">lsa package for R</a>, which provides a number of functions for performing latent semantic analysis. The triangular plot shown above — known as a ternary diagram — was created using the <a target="_blank" rel="nofollow" href="https://mran.microsoft.com/package/ggtern/">ggtern package</a>.</p>
<p>For the complete subreddit analysis, and the list of subreddits close to Donald Trump based on the analysis, check out the FiveThirtyEight article linked below.</p>
<p>FiveThirtyEight: <a target="_blank" rel="nofollow" href="https://fivethirtyeight.com/features/dissecting-trumps-most-rabid-online-following/">Dissecting Trump's Most Rabid Following</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/03/comparing-subreddits.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/W6cFHoOqEUM"></a></div>