d3heatmapOutput: Wrapper functions for using d3heatmap in shiny

View source: R/d3heatmap.R

d3heatmapOutputR Documentation

Wrapper functions for using d3heatmap in shiny

Description

Use d3heatmapOutput to create a UI element, and renderD3heatmap to render the heatmap.

Usage

d3heatmapOutput(outputId, width = "100%", height = "400px")

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

Arguments

outputId

Output variable to read from

width, height

The width and height of the map (see shinyWidgetOutput)

expr

An expression that generates a d3heatmap object

env

The environment in which to evaluate expr

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.

Examples

## Not run: 
library(d3heatmap)
library(shiny)

ui <- fluidPage(
  h1("A heatmap demo"),
  selectInput("palette", "Palette", c("YlOrRd", "RdYlBu", "Greens", "Blues")),
  checkboxInput("cluster", "Apply clustering"),
  d3heatmapOutput("heatmap")
)

server <- function(input, output, session) {
  output$heatmap <- renderD3heatmap({
    d3heatmap(
      scale(mtcars),
      col = input$palette,
      dendrogram = if (input$cluster) "both" else "none"
    )
  })
}

shinyApp(ui, server)

## End(Not run)
  

rstudio/d3heatmap documentation built on Nov. 18, 2024, 9:20 a.m.