<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/a-glance-at-r-bloggers-twitter-feed/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://masalmon.github.io/2017/02/28/rbloggerstweets/"> Maëlle</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>It’s the second time I write a post about the blog aggregator R-bloggers, probably because I’m all about R blogs now that I have one. My husband says my posts are so meta. My first post was about <a target="_blank" rel="nofollow" href="http://www.masalmon.eu/2017/01/29/rbloggersnames/">R blogs names</a>, in this one I shall focus on the last 1,000 tweets from R-bloggers.</p>
<p><span></span></p>
<h1>Getting the tweets</h1>
<p>Thanks to <a target="_blank" rel="nofollow" href="https://github.com/mkearney/rtweet"><code>rtweet</code></a>, this is fairly easy. I get rid of empty columns using <a target="_blank" rel="nofollow" href="https://github.com/sfirke/janitor"><code>janitor</code></a>, which is a package you should really check out if you ever have to clean data.</p>
<div>
<pre><code><span>library</span><span>(</span><span>&quot;rtweet&quot;</span><span>)</span><span> </span><span>rbloggers</span><span> </span><span>&lt;-</span><span> </span><span>get_timeline</span><span>(</span><span>user</span><span> </span><span>=</span><span> </span><span>&quot;Rbloggers&quot;</span><span>,</span><span>
</span><span>n</span><span> </span><span>=</span><span> </span><span>1000</span><span>)</span><span>
</span><span>rbloggers</span><span> </span><span>&lt;-</span><span> </span><span>janitor</span><span>::</span><span>remove_empty_cols</span><span>(</span><span>rbloggers</span><span>)</span><span>
</span><span>readr</span><span>::</span><span>write_csv</span><span>(</span><span>rbloggers</span><span>,</span><span> </span><span>path</span><span> </span><span>=</span><span> </span><span>&quot;data/2017-02-28-rbloggerstweets.csv&quot;</span><span>)</span><span>
</span><span>knitr</span><span>::</span><span>kable</span><span>(</span><span>head</span><span>(</span><span>rbloggers</span><span>))</span><span>
</span></code></pre>
</div>
<table>
<thead>
<tr>
<th>created_at</th>
<th>status_id</th>
<th>text</th>
<th>source</th>
<th>is_quote_status</th>
<th>retweet_count</th>
<th>favorite_count</th>
<th>lang</th>
<th>user_id</th>
<th>screen_name</th>
<th>mentions_user_id</th>
<th>mentions_screen_name</th>
<th>hashtags</th>
<th>urls</th>
<th>is_retweet</th>
</tr>
</thead>
<tbody>
<tr>
<td>2017-02-28 20:00:42</td>
<td>836667465333673984</td>
<td>How to annotate a plot in ggplot2 https://t.co/78h18Plc5e #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>12</td>
<td>17</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-Crh</td>
<td>FALSE</td>
</tr>
<tr>
<td>2017-02-28 17:00:40</td>
<td>836622157295857665</td>
<td>How to create correlation network plots with corrr and ggraph (and which countries drink like https://t.co/K8g1OkvWMs #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>14</td>
<td>55</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-Cre</td>
<td>FALSE</td>
</tr>
<tr>
<td>2017-02-28 16:11:45</td>
<td>836609848276037636</td>
<td>forecast 8.0 https://t.co/XATCVdeoJ8 #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>15</td>
<td>38</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-Crc</td>
<td>FALSE</td>
</tr>
<tr>
<td>2017-02-28 15:18:28</td>
<td>836596435307081729</td>
<td>New R job: Applied Research Statistician/Methodologist https://t.co/Hfkanf74aM #rstats #DataScience #jobs</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>2</td>
<td>7</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience,jobs</td>
<td>https://www.r-users.com/jobs/applied-research-statisticianmethodologist/</td>
<td>FALSE</td>
</tr>
<tr>
<td>2017-02-28 13:12:59</td>
<td>836564859647033344</td>
<td>[WEBINAR] Trading in Live Markets using R https://t.co/nNGyQOqUmw #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>5</td>
<td>21</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-Cra</td>
<td>FALSE</td>
</tr>
<tr>
<td>2017-02-28 00:40:34</td>
<td>836375506945716226</td>
<td>Video Introduction to Bayesian Data Analysis, Part 2: Why use Bayes? https://t.co/fmHtKr99kw #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>49</td>
<td>101</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-CqZ</td>
<td>FALSE</td>
</tr>
</tbody>
</table>
<p>Now that I have the data, I’ll have a look at the content of the tweet, at their temporal patterns and at their popularity.</p>
<h1>What are the most frequent words?</h1>
<p>For finding the most frequent words in the tweets I use what has now become my usual workflow with <code>tidytext</code>. I remove 4 words that correspond to the hashtags used in every tweet (#rstats and #datascience) and to links (https and t.co)</p>
<div>
<pre><code><span>rbloggers</span><span> </span><span>&lt;-</span><span> </span><span>readr</span><span>::</span><span>read_csv</span><span>(</span><span>&quot;data/2017-02-28-rbloggerstweets.csv&quot;</span><span>)</span><span>
</span><span>library</span><span>(</span><span>&quot;tidytext&quot;</span><span>)</span><span>
</span><span>library</span><span>(</span><span>&quot;dplyr&quot;</span><span>)</span><span>
</span><span>library</span><span>(</span><span>&quot;rcorpora&quot;</span><span>)</span><span>
</span><span>library</span><span>(</span><span>&quot;lubridate&quot;</span><span>)</span><span>
</span><span>library</span><span>(</span><span>&quot;ggplot2&quot;</span><span>)</span><span>
</span><span>library</span><span>(</span><span>&quot;viridis&quot;</span><span>)</span><span>
</span><span>stopwords</span><span> </span><span>&lt;-</span><span> </span><span>corpora</span><span>(</span><span>&quot;words/stopwords/en&quot;</span><span>)</span><span>$</span><span>stopWords</span><span>
</span><span>rbloggers_words</span><span> </span><span>&lt;-</span><span> </span><span>rbloggers</span><span> </span><span>%>%</span><span>
</span><span>unnest_tokens</span><span>(</span><span>word</span><span>,</span><span> </span><span>text</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>count</span><span>(</span><span>word</span><span>,</span><span> </span><span>sort</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>filter</span><span>(</span><span>!</span><span>word</span><span> </span><span>%in%</span><span> </span><span>stopwords</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>filter</span><span>(</span><span>!</span><span>word</span><span> </span><span>%in%</span><span> </span><span>c</span><span>(</span><span>&quot;rstats&quot;</span><span>,</span><span> </span><span>&quot;datascience&quot;</span><span>,</span><span>
</span><span>&quot;t.co&quot;</span><span>,</span><span> </span><span>&quot;https&quot;</span><span>))</span><span>
</span><span>knitr</span><span>::</span><span>kable</span><span>(</span><span>head</span><span>(</span><span>rbloggers_words</span><span>,</span><span> </span><span>n</span><span> </span><span>=</span><span> </span><span>20</span><span>))</span><span>
</span></code></pre>
</div>
<table>
<thead>
<tr>
<th>word</th>
<th>n</th>
</tr>
</thead>
<tbody>
<tr>
<td>data</td>
<td>171</td>
</tr>
<tr>
<td>analysis</td>
<td>62</td>
</tr>
<tr>
<td>jobs</td>
<td>48</td>
</tr>
<tr>
<td>package</td>
<td>46</td>
</tr>
<tr>
<td>job</td>
<td>41</td>
</tr>
<tr>
<td>2</td>
<td>36</td>
</tr>
<tr>
<td>shiny</td>
<td>33</td>
</tr>
<tr>
<td>science</td>
<td>28</td>
</tr>
<tr>
<td>1</td>
<td>27</td>
</tr>
<tr>
<td>2017</td>
<td>26</td>
</tr>
<tr>
<td>regression</td>
<td>22</td>
</tr>
<tr>
<td>learning</td>
<td>20</td>
</tr>
<tr>
<td>scientist</td>
<td>19</td>
</tr>
<tr>
<td>app</td>
<td>18</td>
</tr>
<tr>
<td>map</td>
<td>18</td>
</tr>
<tr>
<td>ggplot2</td>
<td>17</td>
</tr>
<tr>
<td>interactive</td>
<td>17</td>
</tr>
<tr>
<td>rstudio</td>
<td>17</td>
</tr>
<tr>
<td>statistics</td>
<td>17</td>
</tr>
<tr>
<td>model</td>
<td>16</td>
</tr>
</tbody>
</table>
<p>I’m not surprised by the trendy words, I guess you could mix a few of them up and get a pretty cool title, e.g. “How to make an app in RStudio with an interactive map in it” or “let’s analyse data with a regression and plot everything with ggplot2”. I think I’m more surprised that in 1,000 tweets, no word is that predominant.</p>
<h1>When are blog posts published?</h1>
<p>I’ll start with a warning, R-bloggers tweets appear a bit after the actual blog posts are published, about a few hours I’d say. I actually need a second warning, regarding time of day we have to keep in mind R blogs can be written from everywhere on the planet so in theory R-bloggers is an account that never sleeps.</p>
<div>
<pre><code><span>rbloggers</span><span> </span><span>&lt;-</span><span> </span><span>mutate</span><span>(</span><span>rbloggers</span><span>,</span><span> </span><span>wday</span><span> </span><span>=</span><span> </span><span>as.factor</span><span>(</span><span>wday</span><span>(</span><span>created_at</span><span>,</span><span> </span><span>label</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>)))</span><span>
</span><span>rbloggers</span><span> </span><span>&lt;-</span><span> </span><span>mutate</span><span>(</span><span>rbloggers</span><span>,</span><span> </span><span>hour</span><span> </span><span>=</span><span> </span><span>as.factor</span><span>(</span><span>hour</span><span>(</span><span>created_at</span><span>)))</span><span>
</span><span>rbloggers</span><span> </span><span>&lt;-</span><span> </span><span>mutate</span><span>(</span><span>rbloggers</span><span>,</span><span> </span><span>week</span><span> </span><span>=</span><span> </span><span>week</span><span>(</span><span>created_at</span><span>))</span><span>
</span><span>rbloggers</span><span> </span><span>&lt;-</span><span> </span><span>mutate</span><span>(</span><span>rbloggers</span><span>,</span><span> </span><span>day</span><span> </span><span>=</span><span> </span><span>as.Date</span><span>(</span><span>created_at</span><span>))</span><span>
</span></code></pre>
</div>
<p>Note that the reason I can use <code>week</code> is that there are no tweets from more than one year ago in my data.</p>
<p>Here I’ll show the number of tweets by day of the week.</p>
<div>
<pre><code><span>weekday_dat</span><span> </span><span>&lt;-</span><span> </span><span>rbloggers</span><span> </span><span>%>%</span><span>
</span><span>group_by</span><span>(</span><span>week</span><span>,</span><span> </span><span>wday</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>summarize</span><span>(</span><span>n</span><span> </span><span>=</span><span> </span><span>n</span><span>(),</span><span> </span><span>created_at</span><span> </span><span>=</span><span> </span><span>created_at</span><span>[</span><span>1</span><span>])</span><span> </span><span>arrange</span><span>(</span><span>weekday_dat</span><span>,</span><span> </span><span>desc</span><span>(</span><span>n</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>head</span><span>()</span><span> </span><span>%>%</span><span>
</span><span>knitr</span><span>::</span><span>kable</span><span>()</span><span>
</span></code></pre>
</div>
<table>
<thead>
<tr>
<th>week</th>
<th>wday</th>
<th>n</th>
<th>created_at</th>
</tr>
</thead>
<tbody>
<tr>
<td>4</td>
<td>Sun</td>
<td>98</td>
<td>2017-01-22 23:50:19</td>
</tr>
<tr>
<td>4</td>
<td>Mon</td>
<td>82</td>
<td>2017-01-23 23:10:18</td>
</tr>
<tr>
<td>3</td>
<td>Sat</td>
<td>65</td>
<td>2017-01-21 23:52:03</td>
</tr>
<tr>
<td>4</td>
<td>Wed</td>
<td>34</td>
<td>2017-01-25 22:10:27</td>
</tr>
<tr>
<td>4</td>
<td>Fri</td>
<td>19</td>
<td>2017-01-27 23:40:37</td>
</tr>
<tr>
<td>6</td>
<td>Tues</td>
<td>19</td>
<td>2017-02-07 23:50:44</td>
</tr>
</tbody>
</table>
<p>There are a few days with a lot of tweets, which I guess is due to one blog being added and all its posts being shared at once? In any case, I’ll remove these days from the figure by not showing outliers.</p>
<div>
<pre><code><span>ggplot</span><span>(</span><span>weekday_dat</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_boxplot</span><span>(</span><span>aes</span><span>(</span><span>wday</span><span>,</span><span> </span><span>n</span><span>),</span><span>
</span><span>outlier.shape</span><span> </span><span>=</span><span> </span><span>NA</span><span>)</span><span> </span><span>+</span><span>
</span><span>scale_y_continuous</span><span>(</span><span>limits</span><span> </span><span>=</span><span> </span><span>quantile</span><span>(</span><span>weekday_dat</span><span>$</span><span>n</span><span>,</span><span> </span><span>c</span><span>(</span><span>0</span><span>,</span><span> </span><span>0.9</span><span>)))</span><span>
</span></code></pre>
</div>
<p><img alt="plot of chunk unnamed-chunk-5" src="https://i2.wp.com/masalmon.github.io/figure/source/2017-02-28-rbloggerstweets/unnamed-chunk-5-1.png?w=456" data-recalc-dims="1"></p>
<p>I’m not too sure what to conclude as regards a possible day-of-the-week pattern. Maybe I’d need more data, since I don’t even have a full year of data:</p>
<div>
<pre><code><span>min</span><span>(</span><span>rbloggers</span><span>$</span><span>created_at</span><span>)</span><span>
</span></code></pre>
</div>
<div>
<pre><code>## [1] &quot;2016-12-14 19:06:23 UTC&quot;
</code></pre>
</div>
<div>
<pre><code><span>max</span><span>(</span><span>rbloggers</span><span>$</span><span>created_at</span><span>)</span><span>
</span></code></pre>
</div>
<div>
<pre><code>## [1] &quot;2017-02-28 20:00:42 UTC&quot;
</code></pre>
</div>
<p>With more data maybe I could say whether R-bloggers, who I think are often not blogging for work, post more on the week-ends. Thinking of programming, week-ends and weekdays makes me think of <a target="_blank" rel="nofollow" href="https://stackoverflow.blog/2017/02/07/what-programming-languages-weekends/">this very good post of Julia Silge’s</a>.<br>
Similarly for hour of the day (results not shown) I’m a victim, I think, of the size of my dataset. Moreover, even with a bigger sample, I’d still have trouble finding a circadian rythm since it’d mix tweets from several timezones, without any information about the location of the blog author. Too bad! And with years of data I could even look at seasonality!</p>
<h1>How popular are R-bloggers tweets?</h1>
<p>I’ll be honest, this is the primary reason why I got interested into R-bloggers’ feed. I wondered how famous it made my poor young blog. Well if I have to be honest I also wondered how visible an error of mine would be.</p>
<div>
<pre><code><span>ggplot</span><span>(</span><span>rbloggers</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_histogram</span><span>(</span><span>aes</span><span>(</span><span>favorite_count</span><span>))</span><span>
</span></code></pre>
</div>
<p><img alt="plot of chunk unnamed-chunk-7" src="https://i2.wp.com/masalmon.github.io/figure/source/2017-02-28-rbloggerstweets/unnamed-chunk-7-1.png?w=456" data-recalc-dims="1"></p>
<div>
<pre><code><span>ggplot</span><span>(</span><span>rbloggers</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_histogram</span><span>(</span><span>aes</span><span>(</span><span>retweet_count</span><span>))</span><span>
</span></code></pre>
</div>
<p><img alt="plot of chunk unnamed-chunk-7" src="https://i1.wp.com/masalmon.github.io/figure/source/2017-02-28-rbloggerstweets/unnamed-chunk-7-2.png?w=456" data-recalc-dims="1"></p>
<p>Both look like negative binomial distributions, right? But I don’t want to model them, I’m in a minimalistic mood. Note that the median number of retweet is 8 and the median number of favorites is 19. Let’s see which were the most popular tweets.</p>
<div>
<pre><code><span>arrange</span><span>(</span><span>rbloggers</span><span>,</span><span> </span><span>desc</span><span>(</span><span>retweet_count</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>head</span><span>()</span><span> </span><span>%>%</span><span>
</span><span>knitr</span><span>::</span><span>kable</span><span>()</span><span>
</span></code></pre>
</div>
<table>
<thead>
<tr>
<th>created_at</th>
<th>status_id</th>
<th>text</th>
<th>source</th>
<th>is_quote_status</th>
<th>retweet_count</th>
<th>favorite_count</th>
<th>lang</th>
<th>user_id</th>
<th>screen_name</th>
<th>mentions_user_id</th>
<th>mentions_screen_name</th>
<th>hashtags</th>
<th>urls</th>
<th>is_retweet</th>
<th>wday</th>
<th>hour</th>
<th>week</th>
<th>day</th>
</tr>
</thead>
<tbody>
<tr>
<td>2016-12-29 08:02:09</td>
<td>8.143810e+17</td>
<td>7 Visualizations You Should Learn in R https://t.co/p7aww3ueiU #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>119</td>
<td>214</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-BEP</td>
<td>FALSE</td>
<td>Thurs</td>
<td>8</td>
<td>52</td>
<td>2016-12-29</td>
</tr>
<tr>
<td>2017-01-03 17:42:14</td>
<td>8.163389e+17</td>
<td>Why R is the best data science language to learn today https://t.co/Bp5XouKIZ9 #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>101</td>
<td>129</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-BGQ</td>
<td>FALSE</td>
<td>Tues</td>
<td>17</td>
<td>1</td>
<td>2017-01-03</td>
</tr>
<tr>
<td>2017-01-25 03:10:20</td>
<td>8.240920e+17</td>
<td>Free guide to text mining with R https://t.co/o8pkSA3Rke #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>99</td>
<td>191</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-C1p</td>
<td>FALSE</td>
<td>Wed</td>
<td>3</td>
<td>4</td>
<td>2017-01-25</td>
</tr>
<tr>
<td>2017-02-24 10:50:47</td>
<td>8.350795e+17</td>
<td>Announcing ggraph: A grammar of graphics for relational data https://t.co/5jKGoK6Dsu #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>94</td>
<td>141</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-Cpx</td>
<td>FALSE</td>
<td>Fri</td>
<td>10</td>
<td>8</td>
<td>2017-02-24</td>
</tr>
<tr>
<td>2017-02-07 03:50:39</td>
<td>8.288132e+17</td>
<td>Deep Learning in R https://t.co/HTHKDy7mnN #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>92</td>
<td>189</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-Cer</td>
<td>FALSE</td>
<td>Tues</td>
<td>3</td>
<td>6</td>
<td>2017-02-07</td>
</tr>
<tr>
<td>2017-01-28 12:10:33</td>
<td>8.253151e+17</td>
<td>The “Ten Simple Rules for Reproducible Computational Research” are easy to reach for R users https://t.co/9hsKE2FgHt #rstats #DataScience</td>
<td>r-bloggers.com</td>
<td>FALSE</td>
<td>91</td>
<td>122</td>
<td>en</td>
<td>144592995</td>
<td>Rbloggers</td>
<td>NA</td>
<td>NA</td>
<td>rstats,DataScience</td>
<td>https://wp.me/pMm6L-C6O</td>
<td>FALSE</td>
<td>Sat</td>
<td>12</td>
<td>4</td>
<td>2017-01-28</td>
</tr>
</tbody>
</table>
<p>I’m happy to report I’d heard of most of these posts. I feel so well informed.</p>
<p>Now I guessed that the number of retweets and favorites were correlated, so I decided to draw a scatterplot which according to one of the posts above is a visualization you should learn.</p>
<div>
<pre><code><span>ggplot</span><span>(</span><span>rbloggers</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_point</span><span>(</span><span>aes</span><span>(</span><span>retweet_count</span><span>,</span><span> </span><span>favorite_count</span><span>))</span><span>
</span></code></pre>
</div>
<p><img alt="plot of chunk unnamed-chunk-9" src="https://i2.wp.com/masalmon.github.io/figure/source/2017-02-28-rbloggerstweets/unnamed-chunk-9-1.png?w=456" data-recalc-dims="1"></p>
<p>Wow! I was so surprised by this plot that I decided to make the same for another R content aggregator account, <a target="_blank" rel="nofollow" href="https://twitter.com/rweekly_org">R Weekly</a>.</p>
<div>
<pre><code><span>rweekly_org</span><span> </span><span>&lt;-</span><span> </span><span>get_timeline</span><span>(</span><span>user</span><span> </span><span>=</span><span> </span><span>&quot;rweekly_org&quot;</span><span>,</span><span>
</span><span>n</span><span> </span><span>=</span><span> </span><span>1000</span><span>)</span><span>
</span><span>ggplot</span><span>(</span><span>rweekly_org</span><span>)</span><span> </span><span>+</span><span>
</span><span>geom_point</span><span>(</span><span>aes</span><span>(</span><span>retweet_count</span><span>,</span><span> </span><span>favorite_count</span><span>))</span><span> </span><span>+</span><span>
</span><span>ggtitle</span><span>(</span><span>&quot;rweekly_org's timeline&quot;</span><span>)</span><span>
</span></code></pre>
</div>
<p><img alt="plot of chunk unnamed-chunk-10" src="https://i2.wp.com/masalmon.github.io/figure/source/2017-02-28-rbloggerstweets/unnamed-chunk-10-1.png?w=456" data-recalc-dims="1"></p>
<p>Well here we have far less tweets sadly. I still think there might be a golden ratio of some sort hidden here, so I’ll fit linear models to both datasets.</p>
<div>
<pre><code><span>model</span><span> </span><span>&lt;-</span><span> </span><span>lm</span><span>(</span><span>favorite_count</span><span> </span><span>~</span><span> </span><span>retweet_count</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>rbloggers</span><span>)</span><span>
</span><span>broom</span><span>::</span><span>tidy</span><span>(</span><span>model</span><span>)</span><span> </span><span>%>%</span><span> </span><span>knitr</span><span>::</span><span>kable</span><span>()</span><span>
</span></code></pre>
</div>
<table>
<thead>
<tr>
<th>term</th>
<th>estimate</th>
<th>std.error</th>
<th>statistic</th>
<th>p.value</th>
</tr>
</thead>
<tbody>
<tr>
<td>(Intercept)</td>
<td>4.945224</td>
<td>0.4105901</td>
<td>12.04419</td>
<td>0</td>
</tr>
<tr>
<td>retweet_count</td>
<td>1.779315</td>
<td>0.0223167</td>
<td>79.73038</td>
<td>0</td>
</tr>
</tbody>
</table>
<div>
<pre><code><span>model2</span><span> </span><span>&lt;-</span><span> </span><span>lm</span><span>(</span><span>favorite_count</span><span> </span><span>~</span><span> </span><span>retweet_count</span><span>,</span><span> </span><span>data</span><span> </span><span>=</span><span> </span><span>rweekly_org</span><span>)</span><span>
</span><span>broom</span><span>::</span><span>tidy</span><span>(</span><span>model2</span><span>)</span><span> </span><span>%>%</span><span> </span><span>knitr</span><span>::</span><span>kable</span><span>()</span><span>
</span></code></pre>
</div>
<table>
<thead>
<tr>
<th>term</th>
<th>estimate</th>
<th>std.error</th>
<th>statistic</th>
<th>p.value</th>
</tr>
</thead>
<tbody>
<tr>
<td>(Intercept)</td>
<td>2.118446</td>
<td>2.7470733</td>
<td>0.7711648</td>
<td>0.4434471</td>
</tr>
<tr>
<td>retweet_count</td>
<td>1.382438</td>
<td>0.1783162</td>
<td>7.7527315</td>
<td>0.0000000</td>
</tr>
</tbody>
</table>
<p>Now I just hope that if we collected more data for both accounts, the second coefficient estimate would be close to <a target="_blank" rel="nofollow" href="https://en.wikipedia.org/wiki/Golden_ratio">the golden ratio</a>, about 1.618. Or I could let social media specialists explain me why retweets and favorites have this correlation. Or where the mistake in my post is, which I’d like to know before it gets sort of viral thanks to R-bloggers.</p>
<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://masalmon.github.io/2017/02/28/rbloggerstweets/"> Maëlle</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/pgYAgUIdeWw"></a></div>