Matt Dray

# EARL 2018

I gave a talk called Crosstalk: Shiny-like without Shiny1 at the EARL 2018 conference in London.

The crosstalk package by Joe Cheng allows HTML widgets – JavaScript visualisations wrapped in R code – to interact with each other. This can be done inside an R Markdown document (including Flexdashboard) for easy server-less sharing in HTML format.

# Crosstalk in action

Below is a very simple example from the Crosstalk documentation site. Click and drag to highlight points in the interactive plot (d3scatter package) and ‘brush’ the map markers (button in upper left) on the interactive map (leaflet package) and see how selections in each impact each other. Without Crosstalk, selections in one of these widgets would not impact the others.

You can find a more advanced example of Crosstalk in action using Gapminder data. It links HTML widgets from three packages – leaflet, d3scatter and DT – and includes a couple of sliders for filtering. All of this in less than 80 lines of code.

Remember all this is happening in the browser and without Shiny. And all you need to do is give each of your widgets a ‘shared data’ object. So instead of this:

data <- readRDS("data/some_data.RDS")  # get data
datatable(data)  # interactive table

We can just add one extra line to create the shared data object and pass that to our widgets instead:

## Day seven

Turns out I punked you: my talk is called ‘Crosstalk: Shiny-like without Shiny’ but you can actually put Shiny in your Crosstalk. Why? Your brushing and filtering with Crosstalk can be used to generate Shiny outputs and vice versa. For simplicity, my talk focuses only on Crosstalk.

## Bonus memes

All the memes are available as JPEG files in my earl18-presentation GitHub repository. There’s also some extra ones in there.

1. Running joke: Shiny without Shiny? Sounds like a dull talk lol.

2. Answer: because you have better things to do.

3. Scroll to the bottom of that link for bonus memes, you lucky thing.

4. Yeah, but have you seen The New Zealand tourism dashboard?