background preloader

R Apps - Shiny, Plumber APIs

Facebook Twitter

Shiny cheat sheet. Shiny for Interactive App Development using R. Practical intro to Shiny - workshop write-up. Easy way to use Shiny. Shiny - Style your apps with CSS. The user interface for your Shiny app is an HTML document, which means that you can use CSS to style the appearance of your Shiny apps.

Shiny - Style your apps with CSS

CSS is a very simple way to control the visual appearance of web pages. The language is widely used and easy to learn. If you’d like to learn how to write CSS code, I recommend the free codecademy tutorial. Building Dashboards w/R & Shiny + shinydashboard. By Bob Rudis (@hrbrmstr) Sat 24 January 2015 | tags: blog, rstats, r, shiny, dashboard, -- (permalink) Jay & I cover dashboards in Chapter 10 of Data-Driven Security (the book) but have barely mentioned them on the blog.

Building Dashboards w/R & Shiny + shinydashboard

That’s about to change with a new series on building dashboards using the all-new shinydashboard framework developed by RStudio. While we won’t duplicate the full content from the book, we will show different types of dashboards along with the R code used to generate them. Why R/Shiny/shinydashboard? You can make dashboards in a cadre of programs: from Excel to PowerPoint, Tableau to MicroStrategy (a tool of choice for the “Godfather of Dashboards” - Stephen Few), Python to Ruby, plus many canned Saas tools. shinydashboards is compelling since it: It also enables the use of every data gathering, data munging, statistical, computational, visualization & machine-learning package R has to offer to help make your dashboards as meaningful, accurate and appealing as possible. Secure your Shiny apps (against SQL injection) Shiny takes inputs from UI elements and sends them to the server, where the application can access them as R variables.

Secure your Shiny apps (against SQL injection)

While Shiny has security measures in place, as in any typical web application, it remains the developer’s responsibility to sanitize the inputs before using them. For example, Shiny has no way to protect you if you are using an input in a SQL query such as select ... from ... where field = 'input'. Someone manipulating the websocket communication can craft a specially-formatted input that can force the database to execute a query that it is not supposed to do, termed an SQL injection. Shinyjs: perform common JavaScript operations in Shiny apps using plain R code. Shinyjs is my second R package that managed to find its way past the CRAN review process.

shinyjs: perform common JavaScript operations in Shiny apps using plain R code

It lets you perform common useful JavaScript operations in Shiny applications without having to know any JavaScript. Demos You can check out a demo Shiny app (mirror) that lets you play around with some of the functionality that shinyjs makes available, or have a look at a very basic Shiny app (mirror) that uses shinyjs to enhance the user experience with very minimal and simple R code. Availability shinyjs is available through both CRAN (install.packages("shinyjs")) and GitHub (devtools::install_github("daattali/shinyjs")).

Motivation. Persistent data storage in Shiny apps. Shiny apps often need to save data, either to load it back into a different session or to simply log some information.

Persistent data storage in Shiny apps

However, common methods of storing data from R may not work well with Shiny. Functions like write.csv() and saveRDS() save data locally, but consider how works. is a popular server for hosting Shiny apps. It is designed to distribute your Shiny app across different servers, which means that if a file is saved during one session on some server, then loading the app again later will probably direct you to a different server where the previously saved file doesn’t exist. Htmlwidgets for R. Flexdashboard: Easy interactive dashboards for R. Shiny Examples. Show Me Shiny - Gallery of R Web Apps. An Intro to formatR. 1.

An Intro to formatR

Installation You can install formatR from CRAN, or XRAN if you want to test the latest development version: install.packages("formatR", repos = " Or check out the Github repository and install from source if you know what this means. This page is always based on the development version. library(formatR) sessionInfo() 2. The formatR package was designed to reformat R code to improve readability; the main workhorse is the function tidy_source(). Long lines of code and comments are reorganized into appropriately shorter onesspaces and indent are added where necessarycomments are preserved in most casesthe number of spaces to indent the code (i.e. tab width) can be specified (default is 4)an else statement in a separate line without the leading } will be moved one line back= as an assignment operator can be replaced with <-the left brace { can be moved to a new line Below is an example of what tidy_source() can do.

Two applications of tidy_source(): 3. FormatR::tidy_app() 4. 5. Discard comments. Dynamic Programing Flu Season. Shiny – Explore Guardian Uni Tables 2014. Have data – now what?

Shiny – Explore Guardian Uni Tables 2014

Building your own interactive data explorer need not be a chore with the R shiny library… Here’s a quick walkthrough… In Datagrabbing Commonly Formatted Sheets from a Google Spreadsheet – Guardian 2014 University Guide Data, I showed how to grab some data from several dozen commonly formatted sheets in a Google spreadsheet, and combine them to produce a single monolithic data set. The data relates to UK universities and provides several quality/satisfaction scores for each of the major subject areas they offer courses in.

We could upload this data to something like Many Eyes in order to generate visualisations over it, or we could create a visual data explorer app of our own. It needn’t take too long, either… Here’s an example, the Simple Guardian University Rankings 2014 Explorer, that lets you select a university and then generate a scatterplot that shows how different quality/ranking scores vary for that university by subject area: A user interface definition file. Shiny at AdRoll. Shiny app based on annyang that responds to voice input. Shiny Apps - Matthew Leonawicz.