I have been following RStudio’s Shiny project for a while. I think Shiny applications are a pretty neat way to explore data interactively. As the Political Terror Scale website currently has very little to offer in terms of an interactive way to visualize and explore the data, I thought I mess around with Shiny and see if I could make sense of it and produce anything even remotely reasonable.
It turns out that RStudio provides an incredibly useful tutorial for getting started with Shiny. All one has to do is to install the shiny package in R and follow the instructions in the tutorial. From then on out little else is required beyond basic R knowledge.
Below I reproduce the code for the little test application I wrote. The application itself is hosted on shinyapps.io and can be accessed there: PTS Shiny App.1 Please note that my code is terribly cumbersome, inefficient, and inelegant. The ShinyApp servers are also pretty slow, I think. In any case the app is probably not going to be very smooth and/or responsive. Any suggestions will be appreciated.
ui.R
… and …
server.R
It took me a while to figure out how to deploy the shiny application I wrote. It is important that your R packages are up-to-date, that you specify an app name that is not too short and not too long (and doesn’t contain any funky characters). You also need the devtools and shinyapps R packages. They are available on GitHub. For some reason the documentation for ShinyApps and instructions for how to deploy your app to the ShinyApps servers is kind of hidden. Here’s the link: ShinyApps. ↩