The mission of this group is to bring together utility professionals in the power industry who are in the thick of the digital utility transformation. 

27,035 Members

Post

Simple and elegant deployment of analytics on the web using RStudio and Shiny

RStudio

I’ve been using the R language for several years to perform data analysis and I recently had an opportunity to “test drive” RStudio’s Shiny Web deployment tool. The description of Shiny is concise, “Makes it incredibly easy to build interactive web applications with R. Automatic "reactive" binding between inputs and outputs and extensive prebuilt widgets make it possible to build beautiful, responsive, and powerful applications with minimal effort.”, which peaked my curiosity because nothing to do with R seems “easy”.

I started by viewing the Shiny tutorial produced by Garrett Grolemund. This is a fast paced, but extremely effective introduction on how to build a Shiny app. After 30 minutes of watching the video I felt confident that I could construct a “simple” Shiny app, using R scripts I already have implemented. The next step was to install the Shiny R package in my RStudio application, which I already have installed. The installation was flawless and I was on my way to creating my first Shiny app. The transformation from a simple R script into a Shiny app was relatively straight forward, using the Shiny app.R template available in the tutorials. Now it was simply a matter of defining the web/html interface UI using the Shiny UI objects and defining the server side function to populate the web output. After a few syntax errors were resolved I had a working Shiny app running on my computer. Not bad for about 1 hour’s work.

RStudio folks also provide a website called shinyapps.io where people can upload their Shiny apps, making them accessible to the internet. So the next step was to deploy my nice new Shiny app on the shinyapps.io website, which is accomplished entirely within RStudio, after setting up an account on shinyapps.io. With my account setup I was ready to deploy my new app, which only takes one command from within RStudio: rsconnect::deployApp() and after a few minutes you receive the URL of your new Shiny app running on the shinyapps.io server. Here is the link to my first Shiny App: https://reallc.shinyapps.io/ISONESolar/

To summarize, I found the RStudio Shiny package to be very intuitive and straight forward to use. The tutorial and documentation are both excellent and there seems to be a robust Shiny user community. I found it to be very easy to build and deploy simple Shiny apps from existing R scripts that I already had around. Congratulations to the RStudio/Shiny development team for producing such a fine piece of software engineering and customer friendly software. It really was easy, just like it said in the description.

Richard Brooks's picture

Thank Richard for the Post!

Energy Central contributors share their experience and insights for the benefit of other Members (like you). Please show them your appreciation by leaving a comment, 'liking' this post, or following this Member.

Discussions

Will Etson's picture
Will Etson on May 10, 2019

Hi Richard,

I'm in the process of deploying a energy focused dashboard and I aggree with your summation. R Shiny is an effective tool for developing and deploying analytics dashboards.

-Will

Richard Brooks's picture
Richard Brooks on May 10, 2019

Happy hacking Will.

Bob Meinetz's picture
Bob Meinetz on May 12, 2019

Richard, are you using this to develop your AOCE proposal? it would be interesting to see solar production profiles juxtaposed against corresponding grid demand profiles.

Richard Brooks's picture
Richard Brooks on May 12, 2019

Hi Bob, AOCE is a combination of a bid/ask futures market to secure capacity and energy(PPAs) to form "capacity commitments" as step 1 of the process. In step 2 the ISO's would be requried to select from the established capacity commitments in order to issue capacity supply obligations (payments). The markets set the price using bid/ask transactions, which incorporates fuel costs and any other costs required for a generator to "be available" . The ISO's optimization solution (MIP), clearing engine, would select from these capacity commitments to issue capacity supply obligations using a priority approach (objective funtion)  based on 1: satisfy State Energy Targets and 2: Secure required capacity to satisfy Reliability Requirements, using a priority capacity heirarchy, all using a cost surve to ensure lowest cost of supply within each category. I could prototype this in R but  a "real MIP optimization solution" would be needed for production.

I plan to deploy more analytics to shinyapps.io overtime - it's so simple.

Get Published - Build a Following

The Energy Central Power Industry Network is based on one core idea - power industry professionals helping each other and advancing the industry by sharing and learning from each other.

If you have an experience or insight to share or have learned something from a conference or seminar, your peers and colleagues on Energy Central want to hear about it. It's also easy to share a link to an article you've liked or an industry resource that you think would be helpful.

                 Learn more about posting on Energy Central »