<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/feeder-reading-rss-and-atom-feeds-from-r/"></div></div><div><a data-url="https://www.r-bloggers.com/feeder-reading-rss-and-atom-feeds-from-r/" data-counturl="https://www.r-bloggers.com/feeder-reading-rss-and-atom-feeds-from-r/" data-count="horizontal" data-text="feedeR: Reading RSS and Atom Feeds from R" 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://www.exegetic.biz/blog/2016/08/feeder-reading-rss-atom-feeds-r/"> R – Exegetic Analytics</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>I’m working on a project in which I need to systematically parse a number of <a target="_blank" href="https://en.wikipedia.org/wiki/RSS">RSS</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/Atom_(standard)">Atom</a> feeds from within R. I was somewhat surprised to find that no package currently exists on CRAN to handle this task. So this presented the opportunity for a bit of DIY.</p>
<p>You can find the fruits of my morning’s labour <a target="_blank" href="https://github.com/DataWookie/feedeR">here</a>.</p>
<h2>Installing and Loading</h2>
<p>The package is currently hosted on GitHub.</p>
<pre>
> devtools::install_github(&quot;DataWookie/feedeR&quot;)
> library(feedeR)
</pre>
<h2>Reading a RSS Feed</h2>
<p>Although Atom is supposed to be a better format from a technical perspective, RSS is relatively ubiquitous. The vast majority of blogs provide an RSS feed. We’ll look at the feed exposed by <a target="_blank" href="https://www.r-bloggers.com/">R-bloggers</a>.</p>
<pre>
> rbloggers &lt;- feed.extract(&quot;https://feeds.feedburner.com/RBloggers&quot;)
> names(rbloggers)
[1] &quot;title&quot;   &quot;link&quot;    &quot;updated&quot; &quot;items&quot;
</pre>
<p>There are three metadata elements pertaining to the feed.</p>
<pre>
> rbloggers[1:3]
$title
[1] &quot;R-bloggers&quot;

$link
[1] &quot;https://www.r-bloggers.com&quot;

$updated
[1] &quot;2016-08-06 09:15:54 UTC&quot;
</pre>
<p>The actual entries on the feed are captured in the <code>items</code> element. For each entry the <code>title</code>, publication <code>date</code> and <code>link</code> are captured. There are often more fields available for each entry, but these three are generally present.</p>
<pre>
> nrow(rbloggers$items)
[1] 8
> head(rbloggers$items, 3)
                                                              title                date
1                                                       readr 1.0.0 2016-08-05 20:25:05
2 Map the Life Expectancy in United States with data from Wikipedia 2016-08-05 19:48:53
3 Creating Annotated Data Frames from GEO with the GEOquery package 2016-08-05 19:35:45
                                                                                           link
1                                                       https://www.r-bloggers.com/readr-1-0-0/
2 https://www.r-bloggers.com/map-the-life-expectancy-in-united-states-with-data-from-wikipedia/
3 https://www.r-bloggers.com/creating-annotated-data-frames-from-geo-with-the-geoquery-package/
</pre>
<h2>Reading an Atom Feed</h2>
<p>Atom feeds are definitely in the minority, but this format is still used by a number of popular sites. We’ll look at the feed from <a target="_blank" href="https://journal.r-project.org/">The R Journal</a>.</p>
<pre>
> rjournal &lt;- feed.extract(&quot;http://journal.r-project.org/rss.atom&quot;)
</pre>
<p>The same three elements of metadata are present.</p>
<pre>
> rjournal[1:3]
$title
[1] &quot;The R Journal&quot;

$link
[1] &quot;http://journal.r-project.org&quot;

$updated
[1] &quot;2016-07-23 13:16:08 UTC&quot;
</pre>
<p>Atom feeds do not appear to consistently provide the date on which each of the entries was originally published. The <code>title</code> and <code>link</code> fields are always present though!</p>
<pre>
> head(rjournal$items, 3)
                                                                                title date
1                         Heteroscedastic Censored and Truncated Regression with crch   NA
2 An Interactive Survey Application for Validating Social Network Analysis Techniques   NA
3            quickpsy: An R Package to Fit Psychometric Functions for Multiple Groups   NA
                                                                     link
1  http://journal.r-project.org/archive/accepted/messner-mayr-zeileis.pdf
2        http://journal.r-project.org/archive/accepted/joblin-mauerer.pdf
3 http://journal.r-project.org/archive/accepted/linares-lopez-moliner.pdf
</pre>
<h2>Outlook</h2>
<p>I’m still testing this across a selection of feeds. If you find a feed that breaks the package, please <a target="_blank" href="https://github.com/DataWookie/feedeR/issues">let me known</a> and I’ll debug as necessary.</p>
<p>The post <a target="_blank" rel="nofollow" href="http://www.exegetic.biz/blog/2016/08/feeder-reading-rss-atom-feeds-r/">feedeR: Reading RSS and Atom Feeds from R</a> appeared first on <a target="_blank" rel="nofollow" href="http://www.exegetic.biz/blog">Exegetic Analytics</a>.</p>
<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/feeder-reading-rss-and-atom-feeds-from-r/"></div></div><div><a data-url="https://www.r-bloggers.com/feeder-reading-rss-and-atom-feeds-from-r/" data-counturl="https://www.r-bloggers.com/feeder-reading-rss-and-atom-feeds-from-r/" data-count="vertical" data-text="feedeR: Reading RSS and Atom Feeds from R" 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://www.exegetic.biz/blog/2016/08/feeder-reading-rss-atom-feeds-r/"> R – Exegetic Analytics</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/KeeGGJUrZfc"></a></div>