SlideShare a Scribd company logo
Dashboard Development in R
Rick Wargo
@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/
Why Dashboards in R?
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
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, model, and visualize
• observations are in rows
• variables are in columns
• contained in a single dataset
• Augment
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)
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!
Dashboards
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, …
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
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 &
Encapsulation, Returning Exported Vars
Contact Me
https://www.rickwargo.com/
https://github.com/rickwargo
https://linkedin.com/in/rickwargo
contact@epicminds.com
@rickwargo

More Related Content

Similar to Sql Saturday #638 - Dashboard Development in R

Machine Learning Models in Production
Machine Learning Models in ProductionMachine Learning Models in Production
Machine Learning Models in Production
DataWorks Summit
 
The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)
Simon Willison
 
Borden_resume_1JUN16
Borden_resume_1JUN16Borden_resume_1JUN16
Borden_resume_1JUN16
Gary Borden
 
Building the Foundations of an Intelligent, Event-Driven Data Platform at EFSA
Building the Foundations of an Intelligent, Event-Driven Data Platform at EFSABuilding the Foundations of an Intelligent, Event-Driven Data Platform at EFSA
Building the Foundations of an Intelligent, Event-Driven Data Platform at EFSA
Databricks
 
Automatisation in development and testing - within budget [IronCamp prague 20...
Automatisation in development and testing - within budget [IronCamp prague 20...Automatisation in development and testing - within budget [IronCamp prague 20...
Automatisation in development and testing - within budget [IronCamp prague 20...
David Lukac
 
R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...
R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...
R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...
Edureka!
 
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
Bhavani Akunuri
 
Druid: Under the Covers (Virtual Meetup)
Druid: Under the Covers (Virtual Meetup)Druid: Under the Covers (Virtual Meetup)
Druid: Under the Covers (Virtual Meetup)
Imply
 
R- Introduction
R- IntroductionR- Introduction
R- Introduction
Venkata Reddy Konasani
 
Agile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDBAgile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDB
Russell Jurney
 
Machine Learning, Key to Your Classification Challenges
Machine Learning, Key to Your Classification ChallengesMachine Learning, Key to Your Classification Challenges
Machine Learning, Key to Your Classification Challenges
Marc Borowczak
 
Ted Willke, Intel Labs MLconf 2013
Ted Willke, Intel Labs MLconf 2013Ted Willke, Intel Labs MLconf 2013
Ted Willke, Intel Labs MLconf 2013
MLconf
 
SAP
SAPSAP
DBA_Kuppam_Saikrishna_B-Tech (1)
DBA_Kuppam_Saikrishna_B-Tech (1)DBA_Kuppam_Saikrishna_B-Tech (1)
DBA_Kuppam_Saikrishna_B-Tech (1)
sai krishna
 
Offshore Recruiting Training Material
Offshore Recruiting Training MaterialOffshore Recruiting Training Material
Offshore Recruiting Training Material
johnpaka
 
Yahoo! Hack India: Hyderabad 2013 | Building Data Products At Scale
Yahoo! Hack India: Hyderabad 2013 | Building Data Products At ScaleYahoo! Hack India: Hyderabad 2013 | Building Data Products At Scale
Yahoo! Hack India: Hyderabad 2013 | Building Data Products At Scale
Yahoo Developer Network
 
ETL
ETL ETL
ETL
butest
 
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkBest Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Databricks
 
(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide
Mark Rackley
 
Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...
Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...
Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...
Sergii Khomenko
 

Similar to Sql Saturday #638 - Dashboard Development in R (20)

Machine Learning Models in Production
Machine Learning Models in ProductionMachine Learning Models in Production
Machine Learning Models in Production
 
The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)The Django Web Framework (EuroPython 2006)
The Django Web Framework (EuroPython 2006)
 
Borden_resume_1JUN16
Borden_resume_1JUN16Borden_resume_1JUN16
Borden_resume_1JUN16
 
Building the Foundations of an Intelligent, Event-Driven Data Platform at EFSA
Building the Foundations of an Intelligent, Event-Driven Data Platform at EFSABuilding the Foundations of an Intelligent, Event-Driven Data Platform at EFSA
Building the Foundations of an Intelligent, Event-Driven Data Platform at EFSA
 
Automatisation in development and testing - within budget [IronCamp prague 20...
Automatisation in development and testing - within budget [IronCamp prague 20...Automatisation in development and testing - within budget [IronCamp prague 20...
Automatisation in development and testing - within budget [IronCamp prague 20...
 
R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...
R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...
R Tutorial For Beginners | R Programming Tutorial l R Language For Beginners ...
 
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
 
Druid: Under the Covers (Virtual Meetup)
Druid: Under the Covers (Virtual Meetup)Druid: Under the Covers (Virtual Meetup)
Druid: Under the Covers (Virtual Meetup)
 
R- Introduction
R- IntroductionR- Introduction
R- Introduction
 
Agile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDBAgile Data Science 2.0: Using Spark with MongoDB
Agile Data Science 2.0: Using Spark with MongoDB
 
Machine Learning, Key to Your Classification Challenges
Machine Learning, Key to Your Classification ChallengesMachine Learning, Key to Your Classification Challenges
Machine Learning, Key to Your Classification Challenges
 
Ted Willke, Intel Labs MLconf 2013
Ted Willke, Intel Labs MLconf 2013Ted Willke, Intel Labs MLconf 2013
Ted Willke, Intel Labs MLconf 2013
 
SAP
SAPSAP
SAP
 
DBA_Kuppam_Saikrishna_B-Tech (1)
DBA_Kuppam_Saikrishna_B-Tech (1)DBA_Kuppam_Saikrishna_B-Tech (1)
DBA_Kuppam_Saikrishna_B-Tech (1)
 
Offshore Recruiting Training Material
Offshore Recruiting Training MaterialOffshore Recruiting Training Material
Offshore Recruiting Training Material
 
Yahoo! Hack India: Hyderabad 2013 | Building Data Products At Scale
Yahoo! Hack India: Hyderabad 2013 | Building Data Products At ScaleYahoo! Hack India: Hyderabad 2013 | Building Data Products At Scale
Yahoo! Hack India: Hyderabad 2013 | Building Data Products At Scale
 
ETL
ETL ETL
ETL
 
Best Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache SparkBest Practices for Building and Deploying Data Pipelines in Apache Spark
Best Practices for Building and Deploying Data Pipelines in Apache Spark
 
(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide(Updated) SharePoint & jQuery Guide
(Updated) SharePoint & jQuery Guide
 
Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...
Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...
Building Ranking Infrastructure: Data-Driven, Lean, Flexible - Sergii Khomenk...
 

Recently uploaded

STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
sameer shah
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
AlessioFois2
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
nuttdpt
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
Roger Valdez
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
g4dpvqap0
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
Timothy Spann
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
Sm321
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Fernanda Palhano
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
bopyb
 
Learn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queriesLearn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queries
manishkhaire30
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
nyfuhyz
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
vikram sood
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
g4dpvqap0
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
Social Samosa
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
Sachin Paul
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
jitskeb
 

Recently uploaded (20)

STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
STATATHON: Unleashing the Power of Statistics in a 48-Hour Knowledge Extravag...
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
 
Challenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more importantChallenges of Nation Building-1.pptx with more important
Challenges of Nation Building-1.pptx with more important
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
 
Learn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queriesLearn SQL from basic queries to Advance queries
Learn SQL from basic queries to Advance queries
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
 

Sql Saturday #638 - Dashboard Development in R

  • 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/
  • 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
  • 6. Let’s Use Apple Health Data - Steps Data Acquisition from Analytics Playbook Export Health Data from iPhone 1 3 2
  • 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. 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. 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!
  • 11.
  • 12. 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, …
  • 13. 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
  • 14. Examples • Streaming CRAN data • Twin Cities Buses
  • 15. My Apple Health Data Shiny Dashboard
  • 17. Send an email via R Markdown/knitr
  • 19. Serve a Dashboard in Slack
  • 20. More Learning Coursera – Data Science Specialization R Libraries • lrequire: Sources an R "Module" with Caching & Encapsulation, Returning Exported Vars

Editor's Notes

  1. 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.
  2. Why Dashboards? You wouldn’t be here if you could not answer this part of the question. We will not cover how to build a good dashboard – this is an entire presentation in itself. We also will not cover selecting the right KPI’s or dashboard representations
  3. For an introduction to R and SQL Server, see Dan Hartshorn’s session immediately following in this room! Compare creating dashboards in Excel – semi easy to acquire and augment data. Cleansing is a bit more difficult. Delivery is challenged. Not a lot of reusable components. Excel is hard – a study in 2013 found 88% of spreadsheets had significant errors. And best of all, it’s cheap, if not free! Of course, if you want to pay for support and tools, R can do that, too!
  4. It’s all about the data and the data insights All dashboards are data-driven with regularly updated (and correct) data Ideally, in a real dashboard environment, this data refresh would be automated. We won’t cover all of the different ways of acquiring data. In this session, we’ll get data from an XML source (first time for me:)
  5. 80% of the effort of analysis is spent just getting the data ready to analyze, the process of data cleaning Getting data tidy: getting the data in a format that is easy to manipulate, model, and visualize R is an awesome tool to get this job done, and get it done consistently
  6. Not the perfect example of making a dataset tidy, however… Augments the data set with time data Makes it available for quick reuse I typically will spend a good amount of time acquiring and cleansing data and make available for reuse to a dashboarding routine
  7. To consume the data, use the nifty lrequire module to load the data (one time) and return. Future uses will pull from memory and be quick – the acquisition/cleansing process is typically time consuming This becomes integral for an iterative cycle around dashboard development Run through this in R
  8. All different types of dashboards can be made with R – with rich visualizations, static and dynamic content, and a variety of libraries to make it easier
  9. Shiny, by R Studio, the same folks who brought the defacto R IDE These are some of the major players when it comes to dashboard tools. There are many more and most of these are free!
  10. Do the Create a New Shiny Web App, show it and publish it to show hosted solution. Not what I would call a dashboard, “yet” but can be turned into one.
  11. Do the Create a New Shiny Web App, show it and publish it to show hosted solution. Not what I would call a dashboard, “yet” but can be turned into one.
  12. Do the Create a New Shiny Web App, show it and publish it to show hosted solution. Not what I would call a dashboard, “yet” but can be turned into one.
  13. Written with R Markdown so that it is easy to format. Output to HTML or PDF Send in an email Demo flex.Rmd Demo email.R
  14. Written with R Markdown so that it is easy to format. Output to HTML or PDF Send in an email Demo flex.Rmd Demo email.R
  15. Beautiful graphics Support in different languages (R, Python, build one online) $$$
  16. Very cool self-service dashboarding/reporting!
  17. Coursera course started May 29, 2017 – lots of opportunities to sign up