<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/some-ideas-for-your-internal-r-package/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://rviews.rstudio.com/2017/07/19/supporting-corporate-r-user-groups/"> R Views</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p> <br>
</p>
<p><br>
</p>
<p>At RStudio, I have the pleasure of interacting with data science teams around the world. Many of these teams are led by R users stepping into the role of <a rel="nofollow" href="https://rviews.rstudio.com/2017/06/21/analytics-administration-for-r/" target="_blank">analytic admins</a>. These users are responsible for supporting and growing the R user base in their organization and often lead internal R user groups.</p>
<p>One of the most successful strategies to support a corporate R user group is the creation of an internal R package. This article outlines some common features and functions shared in internal packages. Creating an R package is easier than you might expect. A good place to start is this <a rel="nofollow" href="https://www.rstudio.com/resources/webinars/rstudio-essentials-webinar-series-programming-part-3/" target="_blank">webinar on package creation</a>.</p>
<div>
<h2>Logos and Custom CSS</h2>
<p>Interestingly, one powerful way to increase the adoption of data science outputs – plots, reports, and even slides – is to stick to consistent branding. Having a common look and feel makes it easier for management to recognize the work of the data science team, especially as the team grows. Consistent branding also saves the R user time that would normally be spent picking fonts and color schemes.</p>
<p>It is easy to include logos and custom CSS inside of an R package, and to write wrapper functions that copy the assets from the package to a user’s local working directory. For example, this wrapper function adds a logo from the <code>RStudioInternal</code> package to the working directory:</p>
<pre><code>getLogo &lt;- function(copy_to = getwd()){
      copy_to &lt;- normalizePath(copy_to)
      file.copy(system.file(“logo.png”, package = “RStudioInternal”) , copy_to)
}</code></pre>
<p>Once available, logos and CSS can be added to <a rel="nofollow" href="https://shiny.rstudio.com/articles/css.html" target="_blank">Shiny apps</a> and <a rel="nofollow" href="http://rmarkdown.rstudio.com/html_document_format.html#custom_css" target="_blank">R Markdown documents</a>.</p>
</div>
<div>
<h2>ggplot2 Themes</h2>
<p>Similar to logos and custom CSS, many internal R packages include a custom ggplot2 theme. These themes ensure consistency across plots in an organization, making data science outputs easier to recognize and read.</p>
<p>ggplot2 themes are shared as functions. To get started writing a ggplot2 theme, see <a rel="nofollow" href="http://ggplot2.tidyverse.org/reference/theme.html" target="_blank">resource 1</a>. For inspiration, take a look at the <a rel="nofollow" href="https://cran.r-project.org/web/packages/ggthemes/vignettes/ggthemes.html" target="_blank">ggthemes package</a>.</p>
</div>
<div>
<h2>Data Connections</h2>
<p>Internal R packages are also an effective way to share functions that make it easy for analysts to connect to internal data sources. Nothing is more frustrating for a first time R user than trying to navigate the world of ODBC connections and complex database schemas before they can get started with data relevant to their day-to-day job.</p>
<p>If you’re not sure where to begin, look through your own scripts for common database connection strings or configurations. <a rel="nofollow" href="https://db.rstudio.com/" target="_blank">db.rstudio.com</a> can provide more information on how to handle credentials, drivers, and config files.</p>
</div>
<div>
<h2>learnr Tutorials</h2>
<p>RStudio recently released a new package for creating interactive tutorials in R Markdown called <a rel="nofollow" href="https://rstudio.github.io/learnr/" target="_blank">learnr</a>. There are many great resources online for getting started with R, but it can be useful to create tutorials specific to your internal data and domain. learnr tutorials can serve as training wheels for the other components of the internal R package or teach broader concepts and standards accepted across the organization. For example, you might provide a primer that teaches new users your organization’s R style guide.</p>
<div>
<img src="https://i2.wp.com/rviews.rstudio.com/post/2017-07-17-corporate-r-user-groups/learnr_example.gif?w=456&ssl=1" data-recalc-dims="1">
</div>
</div>
<div>
<h2>Sharing an Internal R Package</h2>
<p>Internal packages can be built in the RStudio IDE and distributed as tar files. Alternatively, many organizations use RStudio Server or RStudio Server Pro to standardize the R environment in their organization. In addition to making it easy to share an internal package, a standard compute environment keeps new R users from having to spend time installing R, RStudio, and packages. While these are necessary skills, the first interactions with R should get new users to a data insight as fast as possible. RStudio Server Pro also includes IT functions for monitoring and restricting resources.</p>
</div>
<div>
<h2>Wrap Up</h2>
<p>If you are leading an R group, an internal R package is a powerful way to support your users and the adoption of R. Imagine how easy it would be to introduce R to co-workers if they could connect to real, internal data and create a useful, beautiful plot in under 10 minutes. Investing in an internal R packages makes that on boarding experience possible.</p>
</div>
<p> </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://rviews.rstudio.com/2017/07/19/supporting-corporate-r-user-groups/"> R Views</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 rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/my1gFqIa1dA" height="1"></a></div>