<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/make-tilegrams-in-r-with-tilegramsr/"></div></div><div><a data-url="https://www.r-bloggers.com/make-tilegrams-in-r-with-tilegramsr/" data-counturl="https://www.r-bloggers.com/make-tilegrams-in-r-with-tilegramsr/" data-count="horizontal" data-text="Make tilegrams in R with tilegramsR" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2016/10/tilegrams-in-r.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>In this busy election season (here in the US, at least), we're seeing a lot of maps. Some states are red, some states are blue. But there's a problem: voters are not evenly distributed throughout the United States. In this map (the <a target="_blank" href="http://projects.fivethirtyeight.com/2016-election-forecast">firethirtyeight.com US election forecast</a> on October 13) Montana (MT) is a large state shaded red, but only represents 3 of the 538 Electoral College votes. In the big scheme of things, the outcome in Montana doesn't have much impact on the election. Contrast that with the much smaller state New Jersey with 14 electoral votes: a state so small that its label (NJ) doesn't even fit on the map. A pixel in New Jersey represents almost 80x the voting power of a pixel in Montana, but because of its sheer size Montana dominates on the map. </p>
<p><a target="_blank" href="http://projects.fivethirtyeight.com/2016-election-forecast/"><img title="538" alt="538" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01b7c89fa586970b-800wi" border="0"></a></p>
<p>This wouldn't be a problem if all states had an area directly proportional to the number of Electoral College votes, but that's not the case. But we can fix the problem, and make each state represent its voting power proportionately, by instead using a tiled cartogram, or tilegram. FiveThirtyEight helpfully provides a tilegram of its electoral forecasts as well:</p>
<p><a target="_blank" href="http://projects.fivethirtyeight.com/2016-election-forecast/"><img title="Tilegram" alt="Tilegram" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01bb0942d068970d-800wi" border="0"></a></p>
<p>This map gives a much better representative of Clinton's (blue) lead in the race over Trump (red), currently standing at 339 to 199 electoral college votes. </p>
<p>You can make tilegrams in R, thanks to the <a target="_blank" href="https://github.com/bhaskarvk/tilegramsR">tilegramsR</a> package by <a target="_blank" href="http://www.karambelkar.info/">Bhaskar Karambelkar</a>, and available on Github. Specifically, tilegramR provides spatial objects representing the US states scaled by electoral college votes or population, which you can then use in conjunction with the <a target="_blank" href="https://rstudio.github.io/leaflet/">leaflet package</a> to produce maps (and even add interactivity like pop-up data, if you wish). This <a target="_blank" href="http://rpubs.com/bhaskarvk/tilegramsR">RPubs page give several examples of creating tilegrams</a>, inlcuding this map scaled by electoral college votes.</p>
<p><a target="_blank" href="https://bhaskarvk.github.io/tilegramsR/"><img title="TilegramsR" alt="TilegramsR" src="http://revolution-computing.typepad.com/.a/6a010534b1db25970b01bb0942d20e970d-800wi" border="0"></a></p>
<p>For more on the tilegramsR package, check out it home on Github linked below.</p>
<p>Github (bhaskarvk): <a target="_blank" href="https://bhaskarvk.github.io/tilegramsR/">tilegramsR</a> (<a target="_blank" href="http://flowingdata.com/2016/10/13/tilegrams-in-r/">via</a> FlowingData)</p>
<p> </p>
</div>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/make-tilegrams-in-r-with-tilegramsr/"></div></div><div><a data-url="https://www.r-bloggers.com/make-tilegrams-in-r-with-tilegramsr/" data-counturl="https://www.r-bloggers.com/make-tilegrams-in-r-with-tilegramsr/" data-count="vertical" data-text="Make tilegrams in R with tilegramsR" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<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/2016/10/tilegrams-in-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/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=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/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/Dy54gpT96Ss"></a></div>