Skip to contents

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

Usage

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

renderViolin(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 violin() widget.

env

The environment in which to evaluate expr.

quoted

Is expr already quoted? Defaults to FALSE.

Value

violinOutput() returns a Shiny output UI element; renderViolin() returns a Shiny render function.

Examples

if (interactive() && requireNamespace("shiny", quietly = TRUE)) {
  ui <- fluidPage(violinOutput("vln"))
  server <- function(input, output) {
    output$vln <- renderViolin({
      violin(data.frame(feature = rep("G1", 100), group = "A",
                        value = rnorm(100)))
    })
  }
  shinyApp(ui, server)
}