Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Dashboard Development in R
Rick Wargo
@rickwargo
• Works at InfoMC, Inc.
Director, Architecture and Development
• You’ll see me
• At the beach
• Behind the came...
Why Dashboards in R?
Why R?
• Data Acquisition is Easy
• CSV, XML, DB, REST, …
• Libraries-a-Plenty
• Graphing, Analytics, Machine Learning,
Da...
Data Acquisition
Let’s Use Apple Health Data - Steps
Data Acquisition from Analytics Playbook
Export Health Data from iPhone
1
3
2
Get Data Presentation Ready
• Acquire data
• Clean and Tidy
• Tidy: Get the data in a format that is easy to
manipulate, m...
apple_health_data.R
library(lubridate)
library(XML)
# load apple health export.xml file
xml <- xmlParse("~/Code/R/AppleHea...
Consume the Data
library(lrequire)
df <- lrequire(apple_health_data)
or
df <- lrequire(apple_health_data, force.reload = T...
Dashboards
Dashboard Tools in R
Shiny
• Host on your own servers or on Rstudio’s hosting service
• No web development skills required...
Create a Shiny Dashboard
• From R Studio, create a Shiny Web App
• Run app locally (to test)
• Publish to share with small...
Examples
• Streaming CRAN data
• Twin Cities Buses
My Apple Health Data Shiny Dashboard
Create a flexdashboard
Send an email via R Markdown/knitr
Create a Plotly Graph
Serve a Dashboard in Slack
More Learning
Coursera – Data Science Specialization
R Libraries
• lrequire: Sources an R "Module" with Caching &
Encapsul...
Contact Me
https://www.rickwargo.com/
https://github.com/rickwargo
https://linkedin.com/in/rickwargo
contact@epicminds.com...
Sql Saturday #638 - Dashboard Development in R
Upcoming SlideShare
Loading in …5
×

Sql Saturday #638 - Dashboard Development in R

322 views

Published on

Often the first choice for statistics, data analysis, and machine learning, R has a variety of use cases that make it a great fit. And due to the open-source nature of R, there are many packages that make R a great tool for developing dashboards. In this session, we will discover and understand how to build dashboards in R using a few different patterns. We will also understand how to deliver this content to the consumer in multiple forms, including on-demand (web and bot), interactive (web), and batch (email). You will leave this session with an understanding of how to start developing dashboards in R and how to deliver them to your user community. To get the most from this session, some general knowledge of R and programming languages is required.

Published in: Data & Analytics
  • Be the first to comment

  • Be the first to like this

Sql Saturday #638 - Dashboard Development in R

  1. 1. Dashboard Development in R Rick Wargo
  2. 2. @rickwargo • Works at InfoMC, Inc. Director, Architecture and Development • You’ll see me • At the beach • Behind the camera • Cooking • Developing • Exploring • Frolicking with my family • Published R package – lrequire (makes dashboard development easier) • One of the original ten Alexa Champions • Presentation available at https://www.rickwargo.com/dashboard-development-in-r/
  3. 3. Why Dashboards in R?
  4. 4. Why R? • Data Acquisition is Easy • CSV, XML, DB, REST, … • Libraries-a-Plenty • Graphing, Analytics, Machine Learning, Dashboarding, … • Established Practices for • Getting and Cleansing Data (“tidy”) • Reproducibility • Peer Review
  5. 5. Data Acquisition
  6. 6. Let’s Use Apple Health Data - Steps Data Acquisition from Analytics Playbook Export Health Data from iPhone 1 3 2
  7. 7. Get Data Presentation Ready • Acquire data • Clean and Tidy • Tidy: Get the data in a format that is easy to manipulate, model, and visualize • observations are in rows • variables are in columns • contained in a single dataset • Augment
  8. 8. apple_health_data.R library(lubridate) library(XML) # load apple health export.xml file xml <- xmlParse("~/Code/R/AppleHealthData/apple_health_export/export.xml") # transform xml file to data frame - select the Record rows from the xml file steps.df <- XML:::xmlAttrsToDataFrame(xml['//Record[@type="HKQuantityTypeIdentifierStepCount"]'], stringsAsFactors = FALSE) # make value variable numeric steps.df$value <- as.numeric(steps.df$value) # make endDate in a date time variable POSIXct using lubridate with eastern time zone steps.df$endDate <- ymd_hms(steps.df$endDate, tz="America/New_York") # augment data - add in year month date dayofweek hour period columns steps.df$month <- format(steps.df$endDate,"%m") steps.df$year <- format(steps.df$endDate,"%Y") steps.df$date <- format(steps.df$endDate,"%Y-%m-%d") steps.df$dayofweek <- wday(steps.df$endDate, label=TRUE, abbr=FALSE) steps.df$hour <- format(steps.df$endDate,"%H") steps.df$period <- format(steps.df$endDate, "%Y-%m") steps.df <- steps.df[steps.df$period>"2016-09",] module.exports <- list(steps=steps.df, summary=summary.df)
  9. 9. Consume the Data library(lrequire) df <- lrequire(apple_health_data) or df <- lrequire(apple_health_data, force.reload = TRUE) Let’s see this in R!
  10. 10. Dashboards
  11. 11. Dashboard Tools in R Shiny • Host on your own servers or on Rstudio’s hosting service • No web development skills required, but you can if you desire • shinydashboard -- install.packages("shinydashboard") • shinythemes -- install.packages("shinythemes") • Extensible flexdashboard for R • Uses R Markdown for publication (knitr is another great option) plotly Dashboards ($$) • Beautiful, publication-quality graphics • API’s for multiple languages including R, Python, Matlab, …
  12. 12. Create a Shiny Dashboard • From R Studio, create a Shiny Web App • Run app locally (to test) • Publish to share with small team – other hosting options available
  13. 13. Examples • Streaming CRAN data • Twin Cities Buses
  14. 14. My Apple Health Data Shiny Dashboard
  15. 15. Create a flexdashboard
  16. 16. Send an email via R Markdown/knitr
  17. 17. Create a Plotly Graph
  18. 18. Serve a Dashboard in Slack
  19. 19. More Learning Coursera – Data Science Specialization R Libraries • lrequire: Sources an R "Module" with Caching & Encapsulation, Returning Exported Vars
  20. 20. Contact Me https://www.rickwargo.com/ https://github.com/rickwargo https://linkedin.com/in/rickwargo contact@epicminds.com @rickwargo

×