Crosstalk is an add-on to the htmlwidgets package. It extends htmlwidgets with a set of classes, functions, and conventions for implementing cross-widget interactions (currently, linked brushing and filtering).
Play with the example below by manipulating the slider, clicking rows in the data table, and playing with the selection button in the map.
library(crosstalk) library(leaflet) library(DT) # Wrap data frame in SharedData sd <- SharedData$new(quakes[sample(nrow(quakes), 100),]) # Create a filter input filter_slider("mag", "Magnitude", sd, column=~mag, step=0.1, width=250) # Use SharedData like a dataframe with Crosstalk-enabled widgets bscols(device = "md", leaflet(sd) %>% addTiles() %>% addMarkers(), datatable(sd, extensions="Scroller", style="bootstrap", class="compact", width="100%", height="auto", options=list(deferRender=TRUE, scrollY=300, scroller=TRUE)) )
Like regular HTML widgets, Crosstalk doesn't require Shiny or any other runtime R dependencies. That means you can use it, either alone or with R Markdown, to generate static HTML documents that can be hosted anywhere, including Amazon S3, GitHub, or RPubs. However, it is also designed to work seamlessly with Shiny apps, which lets you combine Crosstalk widget interactions with base plots, ggplot2, and anything else you can do with Shiny.
Crosstalk has inherent limitations that widget authors and users need to be aware of.
Both widget users and widget authors should read the Using Crosstalk guide.
Widget authors should then proceed to read Authoring Crosstalk widgets.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.