Combining the Power of DeployR, rCharts, and AngularJS

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

by Sheri Gilley, Principal UI Designer at Revolution Analytics

Revolution R Enterprise DeployR is a server framework that exposes the R platform as a service allowing the integration of R statistics, analytics and visualizations inside Web, desktop and mobile applications.  DeployR’s framework allows users to store and serve up R code that can then easily be used and reused in your own interfaces. By separating the R code from the UI code, not only can you leave the analytics to the R developer and the UI designs to the web developers, but you can also make it easier to unit test and debug the R code. Additionally, this separation of R and UI allows you to make the best use of the best software for each. You can take advantage of choice UI frameworks, such as AngularJS, to develop and solve front-end design issues and DeployR for managing and executing high powered R analytics.

We’ve been getting lots of questions about the rCharts package and whether rCharts output can be integrated into DeployR.  The answer is yes — it is a wonderful way to create a chart in R that you can then augment with interactivity using HTML and JavaScript.  Below is an example of code designed to be executed only once on the DeployR server and then interacted with numerous times on the client-side without any additional load on the server.

A few weeks ago, Joseph Rickert introduced a method for retrieving package information from CRAN.  He created a count of the number of Depends per package, and then plotted a histogram of this count.  This  same data is used in the example below to demonstrate how to combine DeployR, rCharts, and AngularJS to display some histograms.  The code itself will execute only once and all additional interactions occur on the client.

This chart was built with:

  • An R script (Histograms.R) stored on the DeployR server and publicly accessible. This script creates a chart using the rCharts package.
  • An HTML page (index.html) that displays the chart and its interactive controls.
  • A JavaScript file (script.js), using the AngularJS framework, that runs the script once on the DeployR server, and then updates the chart on the client-side whenever a user changes one of the controls. 

You can download the R, HTML, and JavaScript files here.  NOTE: Due to the libraries used in the JavaScript code, this chart is best viewed in the latest version of Chrome, FireFox, Safari, or IE 9+.

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)