<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/r-markdown-for-the-enterprise/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.rstudio.com/rviews/2017/01/25/r-markdown-for-the-enterprise/"> RStudio</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>

<p>by Edgar Ruiz</p>
<p>
In the corporate world, spreadsheets and PowerPoint presentations still dominate as the tools used for analyzing and sharing information. So, it is not at all surprising that even when business analysts use R for the analytical heavy lifting, they frequently revert to using spreadsheets and slide decks to share their results. This may seem like the easiest way to communicate with colleagues, but any modestly complicated project is likely to be error-prone and generate hours of unnecessary rework.</p>
<p>An R-savvy analyst can harness R Markdown to develop reproducible business reporting and information sharing workflows in any business organization; all it takes is a little effort to master some basic R document preparation tools.</p>
<p>In this post, I would like to examine a scenario that represents some experiences I had as an analytics professional. </p>
<h2>“The report is great but…” Scenario</h2>
<p>
<img alt="" src="https://i2.wp.com/www.rstudio.com/wp-content/uploads/2017/01/new_analysis.png?w=456" data-recalc-dims="1"></p>
<p>A new R analysis is delivered in a PowerPoint presentation, and everyone thinks that the insights are very valuable. They all want more associates to see it, so almost immediately, the following three requests are made:</p>
<ul>
<li>
<p><strong>“…we need it broken out by”</strong> – The presentation needs to be split by a specific segment. The segment is normally geographical or managerial in nature.</p>
</li>
<li>
<p><strong>“…they shouldn’t see each others data”</strong> – Since the results are not published in a central publishing platform, it is necessary to create multiple versions of the same report in order to secure the contents.</p>
</li>
<li>
<p><strong>“…we need it every”</strong> – Satisfying requests 1 and 2 may not be too overwhelming if this were meant as a one-time analysis, but usually the analysis and its distribution need to be repeated on a regular interval.</p>
</li>
</ul>
<p>Because we exported the findings into a presentation, sharing results becames more complex and time-consuming if we wish to satisfy the new requirements.</p>
<h2>How can R Markdown help?</h2>
<p><img alt="" src="https://i2.wp.com/www.rstudio.com/wp-content/uploads/2017/01/rmarkdown.png?w=456" data-recalc-dims="1"></p>
<p>R Markdown combines the creation and sharing steps. The three requests can be satisfied using the following features of R Markdown:</p>
<ul>
<li>
<p><strong>Break out the reports</strong> – Using R Markdown’s <a target="_blank" rel="nofollow" href="http://rmarkdown.rstudio.com/developer_parameterized_reports.html">Parameterized Reports</a> feature, we can easily create documents for each required segment.</p>
</li>
<li>
<p><strong>Automate the file creation</strong> – R Markdown can be run from code, so a separate R script can iteratively run the R Markdown and pass a different parameter for each iteration.</p>
</li>
<li>
<p><strong>Create the slides inside R</strong> – Take advantage of <a target="_blank" rel="nofollow" href="http://rmarkdown.rstudio.com/ioslides_presentation_format.html">R Markdown Presentation</a> output to create a slide deck. Without having to learn a new scripting language, we can code the slide deck and use the same Parameter feature to automate its creation.</p>
</li>
<li>
<p><strong>Keep the interactivity</strong> – In many cases, the end user needs a level of interactivity with the report. This interactivity can be achieved by using <a target="_blank" rel="nofollow" href="http://www.htmlwidgets.org/">htmlwidgets</a> inside the R Markdown document. For example, the <a target="_blank" rel="nofollow" href="http://www.htmlwidgets.org/showcase_leaflet.html">Leaflet</a> widget can be used for interactive maps, the <a target="_blank" rel="nofollow" href="http://www.htmlwidgets.org/showcase_datatables.html">Data Table</a> widget for interactive tables, and the <a target="_blank" rel="nofollow" href="http://www.htmlwidgets.org/showcase_dygraphs.html">dygraphs</a> widget for interactive time series charting.</p>
</li>
</ul>
<h3>Additional benefits</h3>
<ul>
<li>
<p><strong>Accessible and easy to open</strong> – Any alternative tool needs to be as accessible as the current spreadsheet and presentation tool. R Markdown can output results in <a target="_blank" rel="nofollow" href="http://rmarkdown.rstudio.com/formats.html">HTML, PDF, and Word</a>. Additionally, the Presentation output uses the highly accessible HTML5 format.</p>
</li>
<li>
<p><strong>Reproducibility</strong> – Copying-and-pasting files, text, or images inevitably introduces human error. In R, data import, wrangling and modeling are already automated, so why not take it to its natural conclusion by using R Markdown to automate the presentation end of the process, as well?</p>
</li>
<li>
<p><strong>Creating a dashboard is easy</strong> – In a spreadsheet, this is normally accomplished with a combination of pivot tables and graphs. R Markdown uses <a target="_blank" rel="nofollow" href="http://rmarkdown.rstudio.com/flexdashboard/">flexdashboard</a> to create visually striking dashboards that are self-contained. By using this in combination with htmlwidgets, the audience gains access to a very powerful tool.</p>
</li>
</ul>
<p><a target="_blank" rel="nofollow" href="http://colorado.rstudio.com:3939/content/239/parameterized-flexdashboard-stock.html">Here is an example</a> of a <strong>live</strong> parameterized R Markdown flexdashboard based on stock data (see screenshot below).</p>
<p><img alt="" src="https://i0.wp.com/www.rstudio.com/wp-content/uploads/2017/01/ibm_app.png?w=456" data-recalc-dims="1"></p>
<h2>How to get started</h2>
<p><strong>R Markdown is a free package</strong>, so if you have R (and ideally RStudio), you can start using it today. Also, there are a lot of resources available for learning how to use R Markdown; the package’s <a target="_blank" rel="nofollow" href="http://rmarkdown.rstudio.com/lesson-1.html">official website</a> is a good place to start.</p>
<p>Here is a sample script that uses Parameterized R Markdown to create a slide deck based on a selected stock. In this case we used Google:</p>
<p></p>
<p>And <a target="_blank" rel="nofollow" href="http://colorado.rstudio.com:3939/content/250/Sample_Presentation.html">here is the resulting deck</a>. Press the left arrow key to see the next slide:</p>
<p>This simple script creates an nice-looking and interactive deck that needs no manual intervention if the data needs to be refreshed, and one small parameter change if a different stock is to be selected.</p>
<h2>Final thought</h2>
<p>We encourage you to try R Markdown yourself. The “start small and then build big” strategy rarely fails, so you could begin by automating a simple report first, and then start taking advantage of more advanced features as you grow comfortable with the tool.</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://www.rstudio.com/rviews/2017/01/25/r-markdown-for-the-enterprise/"> RStudio</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/0h44KcrCWnE"></a></div>