SlideShare a Scribd company logo
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
Largest RStudio::conf Ever!
rstudio.cloud workspace: https://bit.ly/3btckmk
Workshops
Largest R Learning Event In the World!
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
13
Sync up your interactive dashboards
with crosstalk
Github repo: rstd.io/conf20-rmd-dash rstudio.cloud workspace: rstd.io/RMAID
rstudio.cloud workspace: https://bit.ly/3btckmk
If you want to play with crosstalk
yourself• Create an RStudio.cloud account (you only need an email address)
• Go to
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
1
2
rstudio.cloud workspace: https://bit.ly/3btckmk
3
rstudio.cloud workspace: https://bit.ly/3btckmk
4
rstudio.cloud workspace: https://bit.ly/3btckmk
rstudio.cloud workspace: https://bit.ly/3btckmk
Flexdashboard Reference
https://rmarkdown.rstudio.com/flexdashboard/
rstudio.cloud workspace: https://bit.ly/3btckmk
HTML Widgets Create Display
Interactivity• HTML Widgets create interactivity within a Flexdashboard layout pane.
• See all 106 submitted HTML Widgets at: http://gallery.htmlwidgets.org
• You can develop your own if you know Javascript.
• We'll focus on a few:
• Valueboxes and Gauges for individual values
• Plotting with plotly
• Tables with datatable (DT)
• Maps with leaflet
rstudio.cloud workspace: https://bit.ly/3btckmk
Valueboxes Show Single Values
• They dress up single values with an icon and a color
alueBox(params$conf_attendees, "Attendees", icon = "fa-users")
valueBox(paste0(mixers_sat_percent, "%"),
icon = "fa-paper-plane",
color = ifelse(mixers_sat_percent >= 50,
ifelse(mixers_sat_percent >= 75, params$success_color,
params$warning_color),
params$danger_color))
rstudio.cloud workspace: https://bit.ly/3btckmk
Gauges Show Single Values In
Context• They dress up single values with an icon and a color
gauge(my_weather$temperature, min = gauge_minimum_temp, max = gauge_maximum_temp
sectors = gaugeSectors(warning = c(gauge_minimum_temp, gauge_cold_temp),
success = c(gauge_cold_temp,gauge_hot_temp),
danger = c(gauge_hot_temp,gauge_maximum_temp),
colors = gauge_colors))
rstudio.cloud workspace: https://bit.ly/3btckmk
Plotting With Plotly
• Plotly allows you to make any ggplot interactive
• Simply assign your ggplot output to a variable and ggplotly that variable
ggplot(mtcars, aes(disp, hp, color = cyl)) + geom_point()
g <- ggplot(mtcars, aes(disp, hp, color = cyl)) + geom_point()
ggplotly(g)
rstudio.cloud workspace: https://bit.ly/3btckmk
Tables With Data Table
• Displays tables in a nice paged output
• Allows interactive searching and sorting of a table
• Easy to use: just use DT::datatable(data_frame) to display your table.
• Gotcha: the data table library is called DT, not datatable.
DT::datatable(mtcars)
rstudio.cloud workspace: https://bit.ly/3btckmk
Maps With Leaflet
• An easy way to create maps with overlays
• All you need is a data.frame or tibble that has columns lat and lng for
latitude and longitude
• leaflet() %>% addTiles() gives you a basic map
• Usually you just pipe in new layers of markers or polygons that show your
data
leaflet() %>%
addTiles() %>%
addCircleMarkers(data =
latest_earthquakes)
Look at a super-simple dashboard
1. Click on 43-simple-map-and-table.Rmd in the Files pane to open
that file
2. Click Knit
3. Try again if you get a warning about pop-ups
4. Notice that while these 10 earthquakes are interesting, there's no
interactivity
Hint: make one change at a time and test each one before knitting.
EXERCISE
43
Can we increase the
interactivity without
adding complexity?
rstudio.cloud workspace: https://bit.ly/3btckmk
We can create cross-Widget interactivity using
crosstalk
• Crosstalk is an R package that allows interactions in one widget to affect
another
• Documentation is here: https://rstudio.github.io/crosstalk/index.html
• The data used in crosstalk must be a data frame
• Crosstalk only works with HTML widgets designed to support it -- a list of
those is here: https://rstudio.github.io/crosstalk/widgets.html
rstudio.cloud workspace: https://bit.ly/3btckmk
A simple example: 43-simple-map-and-
table.Rmd
To add interactivity, we're going to change this line
rstudio.cloud workspace: https://bit.ly/3btckmk
A simple example: 44-simple-
crosstalk.Rmd
Shared data frame shared_df
created from regular data frame
using S3 function SharedData$new
rstudio.cloud workspace: https://bit.ly/3btckmk
A simple example: 44-simple-
crosstalk.Rmd
Leaflet now reads the
shared data frame shared_df
rstudio.cloud workspace: https://bit.ly/3btckmk
A simple example: 44-simple-
crosstalk.Rmd
Datatable displays shared_df as
a table
Try a simple crosstalk app
1. Click on 44-simple-crosstalk.Rmd in the Files
pane
2. Knit the result
3. Click on the box symbol on the map
4. Draw boxes on the map and see the datatable change
5. Click on specific rows on the table to see that row
highlighted
EXERCISE
44
rstudio.cloud workspace: https://bit.ly/3btckmk
Crosstalk can filter the data frame
too
We add two filters that
allow us to control the
magnitude and depth of
earthquakes
Everything else stays
the same
Experiment with filtering
1. Click on 45-filtered-crosstalk.Rmd in the Files
pane
2. Knit the result
3. Click on the box symbol on the map
4. Draw boxes on the map and see the datatable change
5. Click on specific rows on the table to see that row
highlighted
EXERCISE
45
rstudio.cloud workspace: https://bit.ly/3btckmk
And crosstalk works with plotly
too
Our shared data is now
shared_mtcars
We apply ggplot to our
shared_mtcars and
ggplotly the result
Experiment with crosstalk and plotly
1. Click on 46-crosstalk-multiple.Rmd in the Files
pane
2. Knit the result
3. Click on the Box Select icon in the plotly displays and
then brush across points you want to see
4. Watch the other plots and tables change
EXERCISE
46
rstudio.cloud workspace: https://bit.ly/3btckmk
Beware: crosstalk has limitations
• It only works with widgets designed for it
• leaflet
• plotly
• datatable
• a few others
• All your data must fit in browser memory
• Controls are limited to filtering a data frame
• Check out documentation at
• https://rstudio.github.io/crosstalk/index.html
rstudio.cloud workspace: https://bit.ly/3btckmk
To build general interactive controls, we
need
Shiny
rstudio.cloud workspace: https://bit.ly/3btckmk
Summary
• Dashboards consist of 3 components
• Layouts constructed using R Markdown headers and YAML directives specifying
• Row orientation
• Column orientation
• Storyboard panes
• Displays built from R code and HTML widgets
• Valueboxes
• Plotly
• Datatable
• Leaflet
• Interactive controls which need crosstalk, Shiny, or some other mechanism

More Related Content

Similar to Crosstalk

Consuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source SoftwareConsuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source SoftwareJoanne Cook
 
An introduction to knitr and R Markdown
An introduction to knitr and R MarkdownAn introduction to knitr and R Markdown
An introduction to knitr and R Markdown
sahirbhatnagar
 
Soil and Water Assessment Tool Procedure
Soil and Water Assessment Tool ProcedureSoil and Water Assessment Tool Procedure
Soil and Water Assessment Tool Procedure
KEFA FEYE
 
Surpac geological modelling 3
Surpac geological modelling 3Surpac geological modelling 3
Surpac geological modelling 3
Moulay abdelaziz EL Amrani
 
Ex32018.pdf
Ex32018.pdfEx32018.pdf
Ex32018.pdf
ssuser211b2b
 
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory optionStar Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Franck Pachot
 
Publishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorialPublishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorialSebastian Correa Gimenez
 
Malab tutorial
Malab tutorialMalab tutorial
Malab tutorial
sisira senarathna
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1
benDesigning
 
Point cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihangPoint cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihang
Lihang Li
 
How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2wang yaohui
 
5 Ways to Improve Your LiDAR Workflows
5 Ways to Improve Your LiDAR Workflows5 Ways to Improve Your LiDAR Workflows
5 Ways to Improve Your LiDAR Workflows
Safe Software
 
Frac paq user guide v2.0 release
Frac paq user guide v2.0 releaseFrac paq user guide v2.0 release
Frac paq user guide v2.0 release
joseicha
 
201707 SER332 Lecture 16
201707 SER332 Lecture 16   201707 SER332 Lecture 16
201707 SER332 Lecture 16
Javier Gonzalez-Sanchez
 
WebGL - It's GO Time
WebGL - It's GO TimeWebGL - It's GO Time
WebGL - It's GO Time
Tony Parisi
 
Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)Matthias Trapp
 
Mapreduce Algorithms
Mapreduce AlgorithmsMapreduce Algorithms
Mapreduce Algorithms
Amund Tveit
 

Similar to Crosstalk (20)

Consuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source SoftwareConsuming and Publishing Ordnance Survey Open Data with Open Source Software
Consuming and Publishing Ordnance Survey Open Data with Open Source Software
 
An introduction to knitr and R Markdown
An introduction to knitr and R MarkdownAn introduction to knitr and R Markdown
An introduction to knitr and R Markdown
 
MapReduce in Cloud Computing
MapReduce in Cloud ComputingMapReduce in Cloud Computing
MapReduce in Cloud Computing
 
Soil and Water Assessment Tool Procedure
Soil and Water Assessment Tool ProcedureSoil and Water Assessment Tool Procedure
Soil and Water Assessment Tool Procedure
 
Surpac geological modelling 3
Surpac geological modelling 3Surpac geological modelling 3
Surpac geological modelling 3
 
Ex32018.pdf
Ex32018.pdfEx32018.pdf
Ex32018.pdf
 
UDP Report
UDP ReportUDP Report
UDP Report
 
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory optionStar Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
 
Publishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorialPublishing geoprocessing-services-tutorial
Publishing geoprocessing-services-tutorial
 
Ashwin_Thesis
Ashwin_ThesisAshwin_Thesis
Ashwin_Thesis
 
Malab tutorial
Malab tutorialMalab tutorial
Malab tutorial
 
Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1Hacking the Kinect with GAFFTA Day 1
Hacking the Kinect with GAFFTA Day 1
 
Point cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihangPoint cloud mesh-investigation_report-lihang
Point cloud mesh-investigation_report-lihang
 
How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2How to empower community by using GIS lecture 2
How to empower community by using GIS lecture 2
 
5 Ways to Improve Your LiDAR Workflows
5 Ways to Improve Your LiDAR Workflows5 Ways to Improve Your LiDAR Workflows
5 Ways to Improve Your LiDAR Workflows
 
Frac paq user guide v2.0 release
Frac paq user guide v2.0 releaseFrac paq user guide v2.0 release
Frac paq user guide v2.0 release
 
201707 SER332 Lecture 16
201707 SER332 Lecture 16   201707 SER332 Lecture 16
201707 SER332 Lecture 16
 
WebGL - It's GO Time
WebGL - It's GO TimeWebGL - It's GO Time
WebGL - It's GO Time
 
Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)
 
Mapreduce Algorithms
Mapreduce AlgorithmsMapreduce Algorithms
Mapreduce Algorithms
 

Recently uploaded

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 

Recently uploaded (20)

Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 

Crosstalk