R bindings for deck.gl 9.2.2. The package wraps the deck.gl JSON interface inside an htmlwidget, hydrates data through DuckDB, and ships Shiny bindings so you can drop interactive WebGL maps and large-data visualizations into any R workflow.
Once on CRAN:
install.packages("rDeckgl")Development version from GitHub:
# install.packages("remotes")
remotes::install_github("TiRizvanov/rDeckgl")The deck.gl 9.2.2 JavaScript bundle, JSON converter, default loaders,
CSS, and widget glue are pre-built and shipped under
inst/htmlwidgets/, so no Node or JavaScript tooling is
required at runtime.
library(rDeckgl)
spec <- list(
`@@type` = "DeckGL",
initialViewState = list(longitude = -122.4, latitude = 37.76, zoom = 12),
layers = list(
list(
`@@type` = "ScatterplotLayer",
id = "points",
data = list(type = "duckdb", query = "SELECT lon, lat, radius FROM points"),
getPosition = "@@=[lon, lat]",
getRadius = "@@=radius",
getFillColor = c(255, 0, 0)
)
)
)
data <- list(
points = data.frame(
lon = c(-122.40, -122.45, -122.35),
lat = c( 37.76, 37.78, 37.74),
radius = c(100, 150, 200)
)
)
deckgl(spec, data = data, width = "100%", height = "500px")deckgl() accepts deck.gl JSON specs as R lists, JSON
strings, YAML strings, or file paths; the format is auto-detected. Data
passed via the data argument is registered as DuckDB tables
that your type = "duckdb" data nodes can query.
library(shiny)
library(rDeckgl)
ui <- fluidPage(
deckglOutput("map", width = "100%", height = "600px")
)
server <- function(input, output, session) {
output$map <- renderDeckgl({
deckgl(spec, data = data)
})
}
shinyApp(ui, server)ggsql() exposes the same renderer through the ggsql
dialect — describe a deck.gl visualization with VISUALIZE /
DRAW / PLACE / SCALE clauses
instead of hand-writing JSON. See ?ggsql for the full
reference.
vignette("getting-started", package = "rDeckgl")?deckgl,
?deckglOutput, ?renderDeckgl,
?ggsqlIssues and pull requests are welcome on GitHub. Please
report bugs to the package maintainer listed in
DESCRIPTION.
MIT — see LICENSE for the full text, including the third-party deck.gl license bundled with the JavaScript assets.
Developed in the Dries Lab at Boston University. Funding support was provided by the Dries Lab and the Boston University Undergraduate Research Opportunities Program (UROP).