library(DT)
library(crosstalk)
library(plotly)
sd <- SharedData$new(iris[, c("Sepal.Length", "Sepal.Width")])
crosstalk::bscols(
device = "lg",
datatable(sd, width = "100%"),
plot_ly(sd, x=~Sepal.Length, y=~Sepal.Width)
)1 JFR Chapter 3: Introduction to Widgets
The
htmlwidgetspackage originates from the rCharts package [@vaidyanathanRamnathvRCharts2025] in 2012 by Ramnath Vaidyanathan. It brought together a plethora of data visualisation JavaScript libraries, datamaps, highcharts, morris.js, and many more. Though no longer maintained rCharts ultimately paved the way towards a framework for interactive visualisations in R: two years later, in 2014, Ramnath and other prominent R users start working on htmlwidgets.
1.1 crosstalk package
crosstalkpackage enable multiple html widgets to communicate.bscolsfunction put the visualization and table side-by-side
- Not all html widgets support
crosstalkpackage. You can check out the list of compatible HTML widgets here.
NoteShare Data between HTML widgets
You can select cases in HTML tables and the selection will be reflected in the plot.