Skip to contents

Output and render functions for using spatial() within Shiny applications and interactive R Markdown / Quarto documents.

Usage

spatialOutput(output_id, width = "100%", height = "560px")

renderSpatial(expr, env = parent.frame(), quoted = FALSE)

Arguments

output_id

Output variable to read from.

width, height

Element size, passed to htmlwidgets::shinyWidgetOutput().

expr

An expression that generates a spatial() widget.

env

The environment in which to evaluate expr.

quoted

Is expr already quoted? Defaults to FALSE.

Value

spatialOutput() returns a Shiny output UI element; renderSpatial() returns a Shiny render function.

Examples

if (interactive() && requireNamespace("shiny", quietly = TRUE)) {
  ui <- fluidPage(spatialOutput("sp"))
  server <- function(input, output) {
    output$sp <- renderSpatial({
      spatial(x = runif(50), y = runif(50), color = rnorm(50))
    })
  }
  shinyApp(ui, server)
}