<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/a-data-science-lab-for-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://rviews.rstudio.com/2017/12/20/rstudio-server-quick-start/"> R Views</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>In a <a rel="nofollow" href="https://rviews.rstudio.com/2017/06/21/analytics-administration-for-r/" target="_blank">previous post</a> I described the role of analytic administrator as a data scientist who: onboards new tools, deploys solutions, supports existing standards, and trains other data scientists. In this post I will describe how someone in that role might set up a data science lab for R.</p>
<div>
<h3>Architecture</h3>
<p>A data science lab is an environment for developing code and creating content. It should enhance the productivity of your data scientists and integrate with your existing systems. Your data science lab might live on your premises or in the cloud. It might be built with hardware, virtual machines, or containers. You may use it to support a single data scientist or hundreds of R developers. Here is one reference architecture of a data science lab based on server instances.</p>
<div>
<img src="https://i2.wp.com/rviews.rstudio.com/post/2017-12-20-DS-lab_files/rsp-setup-small.png?w=456&ssl=1" data-recalc-dims="1">
</div>
<p>Key components of this setup include: authentication; load balancing; a testing environment; data connectivity; and a publishing platform. In this server-based architecture, data scientists use a web browser to access the data science lab. High performance compute and live data reside securely behind a firewall.</p>
</div>
<div>
<h3>Instance Sizing</h3>
<p>The size of your server instance depends on how many concurrent sessions you run and how large your sessions are. Keep in mind that R is single threaded by default and holds data in memory. Here is a list of example server sizes:</p>
<table>
<colgroup>
<col width="27%">
<col width="9%">
<col width="9%">
<col width="54%">
</colgroup>
<thead>
<tr>
<th>Instance Size</th>
<th align="center">Cores</th>
<th align="center">RAM</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>Minimum recommended</p>
</td>
<td align="center">
<p>2</p>
</td>
<td align="center">
<p>4G</p>
</td>
<td>
<p>This server will be for lightweight jobs, testing, and sandboxing.</p>
</td>
</tr>
<tr>
<td>
<p>Small</p>
</td>
<td align="center">
<p>4</p>
</td>
<td align="center">
<p>8G</p>
</td>
<td>
<p>This server will support one or two analysts with small data.</p>
</td>
</tr>
<tr>
<td>
<p>Large</p>
</td>
<td align="center">
<p>16</p>
</td>
<td align="center">
<p>256G</p>
</td>
<td>
<p>This server will support 15 analysts with a blend of large and small sessions. Alternatively, it will support dozens of analysts with small sessions.</p>
</td>
</tr>
<tr>
<td>
<p>Jumbo</p>
</td>
<td align="center">
<p>32+</p>
</td>
<td align="center">
<p>1T+</p>
</td>
<td>
<p>May be useful for heavier workloads.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h3>Open-Source R</h3>
<p>If you haven’t done so already, I recommend you <a rel="nofollow" href="https://rviews.rstudio.com/2016/11/16/make-r-a-legitimate-part-of-your-organization/" target="_blank">make R a legitimate part of your organization</a> by officially recognizing it as an analytic standard. You should be familiar with installing and managing R and its packages.</p>
<p>You can install R as a pre-compiled binary from a repository, or you can install R from source. Installing R from source allows you to install <a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/r-versions.html#installing-multiple-versions-of-r" target="_blank">multiple versions of R side by side</a>. If you compile R from source, I recommend you link to the <a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/r-versions.html#building-additional-versions-from-source" target="_blank">BLAS libraries</a> so that you can speed up certain low-level math computations.</p>
<p>Data science labs tend to require a modern toolkit. You should expect to upgrade R at least once a year. You should also keep your operating system up to date. New and improved R packages tend to work better when you use them with recent versions of R and updated system libraries.</p>
</div>
<div>
<h3>RStudio Server Pro</h3>
<p>Building a data science lab involves installing, configuring, and managing tools. In this section I will describe how to administer RStudio Server Pro which has features for authentication, security, and admin controls.</p>
<div>
<h4>1. Installation</h4>
<p>Once you have installed R, you can install <a rel="nofollow" href="https://www.rstudio.com/products/rstudio-server-pro/" target="_blank">RStudio Server Pro</a> by downloading the binaries and following the instructions. You will need root privileges to install and run the software. You will also need to create local system accounts for all of your R developers.</p>
</div>
<div>
<h4>2. Configuration</h4>
<p><strong><a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/authenticating-users.html" target="_blank">Authentication</a>.</strong> The first thing you will want to do after you install RStudio Server Pro is to configure it with your authentication system. RStudio Server Pro supports LDAP via PAM sessions. If you use single sign on or another system, you can configure RStudio Server Pro to work in proxied auth mode. You can also authenticate via Google accounts and local system accounts.</p>
<p><strong><a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/data-connectivity.html" target="_blank">Data Connectivity</a>.</strong> Most data scientists use R with databases. The <a rel="nofollow" href="https://www.rstudio.com/products/drivers/" target="_blank">RStudio Pro Drivers</a> are ODBC drivers that will connect R to some of the most popular databases today. These drivers are a free add-on for RStudio Server Pro. If you are using a data source that is not supported, or if you are using the open source version of RStudio Server, you can bring your own ODBC driver.</p>
<p><strong><a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/load-balancing.html" target="_blank">Load Balancing</a>.</strong> If you want to load balance your server instances, you can use the load balancer that is built into RStudio Server Pro or you can bring your own load balancer. Load balancing is designed to balance user sessions seamlessly across the cluster and provide high availability. It requires a shared home drive that is mounted to each one of the instances.</p>
<p><strong><a rel="nofollow" href="https://www.rstudio.com/products/rstudio-server-pro/" target="_blank">More Features</a>.</strong> RStudio Server Pro has a list of features that you can configure. You should decide which features you want to enable or disable. For more information on configuring each of these features, see the <a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/" target="_blank">admin guide</a>.</p>
<table>
<colgroup>
<col width="38%">
<col width="61%">
</colgroup>
<thead>
<tr>
<th>Feature</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>Authentication</p>
</td>
<td>
<ul>
<li>LDAP, Active Directory, Google Accounts and system accounts</li>
<li>Full support for Pluggable Authentication Modules, Kerberos via PAM, and custom authentication via proxied HTTP header</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Data Connectivity</p>
</td>
<td>
<ul>
<li>RStudio Professional Drivers are ODBC data connectors that help you connect to some of the most popular databases.</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Load Balancing</p>
</td>
<td>
<ul>
<li>Load balance R sessions across two or more servers</li>
<li>Ensure high availability using multiple masters</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Enhanced security</p>
</td>
<td>
<ul>
<li>Encrypt traffic using SSL and restrict client IP addresses</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Administrative dashboard</p>
</td>
<td>
<ul>
<li>Monitor active sessions and their CPU and memory utilization</li>
<li>Suspend, forcibly terminate, or assume control of any active session</li>
<li>Review historical usage and server logs</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Auditing and monitoring</p>
</td>
<td>
<ul>
<li>Monitor server resources (CPU, memory, etc.) on both a per-user and system-wide basis</li>
<li>Send metrics to external systems with the Graphite/Carbon plaintext protocol</li>
<li>Health check with configurable output (custom XML, JSON)</li>
<li>Audit all R console activity by writing input and output to a central location</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Advanced R session management</p>
</td>
<td>
<ul>
<li>Tailor the version of R, reserve CPU, prioritize scheduling and limit resources by User and Group</li>
<li>Provision accounts and mount home directories dynamically via the PAM Session API</li>
<li>Automatically execute per-user profile scripts for database and cluster connectivity</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Project sharing</p>
</td>
<td>
<ul>
<li>Share projects &amp; edit code files simultaneously with others</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>3. Management</h4>
<p>Once RStudio Server Pro is installed and configured, you’ll need to manage it over time. RStudio Server Pro comes with a variety of tools for workspace and server management that will help keep your environment organized. For example, you can kill sessions, set session timeouts, and broadcast notifications to user sessions in real-time. You can manage product <a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/license-management.html" target="_blank">licenses</a> for both online and offline environments. If your instances start and stop frequently you can opt for using a <a rel="nofollow" href="http://docs.rstudio.com/ide/server-pro/license-management.html#floating-licensing" target="_blank">floating license</a> manager.</p>
</div>
</div>
<div>
<h3>Next Steps</h3>
<p>Your data science lab for R should be designed to scale. That might mean adding more people, more systems, or more tools. It also might mean creating more content. <a rel="nofollow" href="http://shiny.rstudio.com/" target="_blank">Shiny</a> is an R package that makes it easy to build interactive web apps straight from R. <a rel="nofollow" href="http://rmarkdown.rstudio.com/" target="_blank">R Markdown</a> is an R package that makes it easy to author reports and build dashboards. You can publish your Shiny apps or R Markdown reports with the push of a button to <a rel="nofollow" href="https://www.rstudio.com/products/connect/" target="_blank">RStudio Connect</a>. RStudio Connect lets you share and manage content in one convenient place. You can also publish Shiny apps to <a rel="nofollow" href="http://shinyapps.io/" target="_blank">shinyapps.io</a>, which allows you to share your Shiny apps online.</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/12/20/rstudio-server-quick-start/"> 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/xS9O4Wsyi9k" height="1"></a></div>