Someone recently mentioned that they were building web apps at their job, and of course, I couldn’t resist. My curious nature and excitement for learning about new programming languages and frameworks burst, and I asked what they were using! Well, they told me they were using Shiny.
I had never heard of it. And so ensued my journey to find out what this was.
Shiny
Well, looking it up, I realized that Shiny was a framework created by the wonderful folks at RStudio that helps you create web apps using the Bootstrap framework. I was excited!
For the past 4 years using R, I have exclusively used RStudio’s Integrated Development Environment (IDE) — Download. It’s pretty awesome and just exactly what you need when coding in R. My excitement wasn’t over yet though.
As I scoured through their website, I got more intrigued when I saw their gallery of example apps. So I decided to go through their “Get Started Tutorial”, and it was awesome! Simple function calls create a entire webpages full of dynamic content, and it couldn’t be easier. I loved the idea!
Below is an example template that illustrates how simple a Shiny app is made. Don’t be fooled though, there is much more to it that makes it super powerful!
library(shiny) ui <- fluidPage( sliderInput(inputId = "num", label = "Chose a number", value = "25", min = 1, max = 100), plotOutput("hist") ) server <- function(input, output) { output$hist <- renderPlot({ title <- paste(input$num, "Random Normal Numbers") hist((rnorm(input$num)), main = title) }) } shinyApp(ui = ui, server = server)
Tutorial
They offer a two and a half (2:25:34) hour long video, a webcast by Garrett Grolemund, that introduces you to Shiny in a very simple, direct way. It was excellent! I really enjoyed going through the framework: it was easy to understand, it had a very clear and concise voice, and I didn’t feel that anxiety of just wanting to finish the video.
The video is separated into 3 sections, and you can find the slide for each here, here, and here. These also come with sample code files, which you will use throughout the lecture, and really delineate how to create full fledge apps. The framework is really easy to understand and learn, and is quite powerful. I encourage anyone who knows or uses R to go check it out! You will not regret it.
Apps
Creating apps with Shiny is so straight forward and easy. It’s functions allow you to create dynamic web apps by writing HTML code with simple function calls. You can even upload and host your apps on shinyaps.io or deploy them on-premises with Shiny Server or Shiny Server Pro.
What really caught my interest was that I have been thinking for over half a year now about developing something similar in Perl. My idea has been to write some modules that automate writing HTMl pages using Bootstrap with simple function calls, much like Shiny. It was great to see that the idea is something that someone can actually find useful, and created one, and it has encouraged me to proceed with that project!
For now, I’ll be working on creating some app using Shiny and learning more on it!
Developer | Bioinformatician – Decoding the world, one line at a time.
Highly motivated developer predominantly working in Linux and developing software tools. All about open source software and fascinated by working with multitudes of technologies and languages. Striving to make a positive impact in this world.