<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/2017-01-authored-package-updates/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://rud.is/b/2017/01/08/2017-01-authored-package-updates/"> R – rud.is</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>The rest of the month is going to be super-hectic and it’s unlikely I’ll be able to do any more to help the push to CRAN 10K, so here’s a breakdown of CRAN and GitHub new packages &amp; package updates that I felt were worth raising awareness on:</p>
<h3>epidata</h3>
<p>I mentioned this one last week but it wasn’t really a package announcement post. <a target="_blank" rel="nofollow" href="https://cran.r-project.org/package=epidata"><code>epidata</code></a> is now on CRAN and is a package to pull data from the <a target="_blank" rel="nofollow" href="http://www.epi.org/">Economic Policy Institute</a> (U.S. gov economic data, mostly). Their “hidden” API is well thought out and the data has been nicely curated (and seems to update monthly). It makes it super easy to do things like the following:</p>
<pre><code>library(epidata)
library(tidyverse)
library(stringi)
library(hrbrmisc) # devtools::install_github(&quot;hrbrmstr/hrbrmisc&quot;)

us_unemp &lt;- get_unemployment(&quot;e&quot;)

glimpse(us_unemp)
## Observations: 456
## Variables: 7
## $ date            &lt;date> 1978-12-01, 1979-01-01, 1979-02-01, 1979-03-0...
## $ all             &lt;dbl> 0.061, 0.061, 0.060, 0.060, 0.059, 0.059, 0.05...
## $ less_than_hs    &lt;dbl> 0.100, 0.100, 0.099, 0.099, 0.099, 0.099, 0.09...
## $ high_school     &lt;dbl> 0.055, 0.055, 0.054, 0.054, 0.054, 0.053, 0.05...
## $ some_college    &lt;dbl> 0.050, 0.050, 0.050, 0.049, 0.049, 0.049, 0.04...
## $ college         &lt;dbl> 0.032, 0.031, 0.031, 0.030, 0.030, 0.029, 0.03...
## $ advanced_degree &lt;dbl> 0.021, 0.020, 0.020, 0.020, 0.020, 0.020, 0.02...

us_unemp %>%
  gather(level, rate, -date) %>%
  mutate(level=stri_replace_all_fixed(level, &quot;_&quot;, &quot; &quot;) %>%
           stri_trans_totitle() %>%
           stri_replace_all_regex(c(&quot;Hs$&quot;), c(&quot;High School&quot;)),
         level=factor(level, levels=unique(level))) -> unemp_by_edu

col &lt;- ggthemes::tableau_color_pal()(10)

ggplot(unemp_by_edu, aes(date, rate, group=level)) +
  geom_line(color=col[1]) +
  scale_y_continuous(labels=scales::percent, limits =c(0, 0.2)) +
  facet_wrap(~level, scales=&quot;free&quot;) +
  labs(x=NULL, y=&quot;Unemployment rate&quot;,
       title=sprintf(&quot;U.S. Monthly Unemployment Rate by Education Level (%s)&quot;, paste0(range(format(us_unemp$date, &quot;%Y&quot;)), collapse=&quot;:&quot;)),
       caption=&quot;Source: EPI analysis of basic monthly Current Population Survey microdata.&quot;) +
  theme_hrbrmstr(grid=&quot;XY&quot;)

us_unemp %>%
  select(date, high_school, college) %>%
  mutate(date_num=as.numeric(date)) %>%
  ggplot(aes(x=high_school, xend=college, y=date_num, yend=date_num)) +
  geom_segment(size=0.125, color=col[1]) +
  scale_x_continuous(expand=c(0,0), label=scales::percent, breaks=seq(0, 0.12, 0.02), limits=c(0, 0.125)) +
  scale_y_reverse(expand=c(0,100), label=function(x) format(as_date(x), &quot;%Y&quot;)) +
  labs(x=&quot;Unemployment rate&quot;, y=&quot;Year ↓&quot;,
       title=sprintf(&quot;U.S. monthly unemployment rate gap (%s)&quot;, paste0(range(format(us_unemp$date, &quot;%Y&quot;)), collapse=&quot;:&quot;)),
       subtitle=&quot;Segment width shows the gap between those with a high school\ndegree and those with a college degree&quot;,
       caption=&quot;Source: EPI analysis of basic monthly Current Population Survey microdata.&quot;) +
  theme_hrbrmstr(grid=&quot;X&quot;) +
  theme(panel.ontop=FALSE) +
  theme(panel.grid.major.x=element_line(size=0.2, color=&quot;#2b2b2b25&quot;)) +
  theme(axis.title.x=element_text(family=&quot;Arial&quot;, face=&quot;bold&quot;)) +
  theme(axis.title.y=element_text(family=&quot;Arial&quot;, face=&quot;bold&quot;, angle=0, hjust=1, margin=margin(r=-14)))</code></pre>
<p><a target="_blank" rel="nofollow" href="https://i0.wp.com/rud.is/b/wp-content/uploads/2017/01/epi1.png?ssl=1"><img alt="" class="wp-image-4855" src="https://i0.wp.com/rud.is/b/wp-content/uploads/2017/01/epi1.png?resize=456%2C217&ssl=1" data-recalc-dims="1"></a></p>
<p><a target="_blank" rel="nofollow" href="https://i2.wp.com/rud.is/b/wp-content/uploads/2017/01/epi2.png?ssl=1"><img alt="" class="wp-image-4854" src="https://i2.wp.com/rud.is/b/wp-content/uploads/2017/01/epi2.png?w=70%25&ssl=1" data-recalc-dims="1"></a></p>
<p>(right edge is high school, left edge is college…I’ll annotate it better next time)</p>
<h3>censys</h3>
<p><a target="_blank" rel="nofollow" href="https://censys.io/">Censys</a> is a search engine by one of the cybersecurity research partners we publish data to at work (free for use by all). The API is moderately decent (it’s mostly a thin shim authentication layer to pass on Google BigQuery query strings to the back-end) and the R package to interface to it <a target="_blank" rel="nofollow" href="https://cran.r-project.org/package=censys"><code>censys</code></a> is now on CRAN.</p>
<h3>waffle</h3>
<p>The seminal square pie chart package <a target="_blank" rel="nofollow" href="https://cran.r-project.org/package=waffle"><code>waffle</code></a> has been updated on CRAN to work better with recent <code>ggplot2</code> 2.x changes and has some additional parameters you may want to check out.</p>
<h3>cdcfluview</h3>
<p>The viral package <a target="_blank" rel="nofollow" href="https://github.com/hrbrmstr/cdcfluview"><code>cdcfluview</code></a> has had some updates on the GitHub version to add saner behaviour when specifying dates and had to be updated as the CDC hidden API switched to all <code>https</code> URLs (major push in .gov-land to do that to get better scores on their cyber report cards). I’ll be adding some features before the next CRAN push to enable retrieval of additional mortality data.</p>
<h3>sergeant</h3>
<p>If you work with <a target="_blank" rel="nofollow" href="https://drill.apache.org/">Apache Drill</a> (if you don’t, you should), the <a target="_blank" rel="nofollow" href="https://github.com/hrbrmstr/sergeant"><code>sergeant</code></a> package (GitHub) will help you whip it into shape. I’ve mentioned it before on the blog but it has a <strong>nigh-complete <code>dplyr</code> interface</strong> now that works pretty well. It also has a direct REST API interface and RJDBC interface plus many helper utilities that help you avoid typing SQL strings to get cluster status info. Once I add the ability to create parquet files with it I’ll push it up to CRAN.</p>
<p>The one thing I’d like to do with this package is support any user-defined functions (UDFs in Drill-speak) folks have written. So, if you have a UDF you’ve written or use and you want it wrapped in the package, just drop an issue and I’ll layer it in. I’ll be releasing some open source cybersecurity-related UDFs via the work github in a few weeks.</p>
<h3>zkcmd</h3>
<p>Drill (in non-standalone mode) relies on <a target="_blank" rel="nofollow" href="https://zookeeper.apache.org/">Apache Zookeeper</a> to keep everything in sync and it’s sometimes necessary to peek at what’s happening inside the zookeeper cluster, so <code>sergeant</code> has a sister package <a target="_blank" rel="nofollow" href="https://github.com/hrbrmstr/zkcmd"><code>zkcmd</code></a> that provides an R interface to zookeeper instances.</p>
<h3>ggalt</h3>
<p>Some helpful folks tweaked <a target="_blank" rel="nofollow" href="https://github.com/hrbrmstr/ggalt"><code>ggalt</code></a> for better ggplot2 2.x compatibility (#ty!) and I added a new <code>geom_cartogram()</code> (before you ask if it makes warped shapefiles: it doesn’t) that restores the old (and what I believe to be the correct/sane/proper) behaviour of <code>geom_map()</code>. I need to get this on CRAN soon as it has both fixes and many new <code>geom</code>s folks will want to play with in a non-GitHub context.</p>
<h2>FIN</h2>
<p>There have been some awesome packages released by others in the past month+ and you should add <a target="_blank" rel="nofollow" href="https://rweekly.org/">R Weekly</a> to your RSS feeds if you aren’t following it already (there are other things you should have there for R updates as well, but that’s for another blog). I’m definitely looking forward to new packages, visualizations, services and utilities that will be coming this year to the R community.</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="https://rud.is/b/2017/01/08/2017-01-authored-package-updates/"> R – rud.is</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/USO467CbvGs"></a></div>