Shiny usage

library(shiny)
library(esquisse)

Use esquisse as a Shiny module

{esquisse} is built with Shiny modules (see this article for reference), so you can use {esquisse} directly into a Shiny application :

ui <- fluidPage(
  
  titlePanel("Use esquisse as a Shiny module"),
  
  sidebarLayout(
    sidebarPanel(
      radioButtons(
        inputId = "data", 
        label = "Data to use:", 
        choices = c("iris", "mtcars"),
        inline = TRUE
      )
    ),
    mainPanel(
      tags$div(
        style = "height: 700px;", # needs to be in fixed height container
        esquisserUI(
          id = "esquisse", 
          header = FALSE, # dont display gadget title
          choose_data = FALSE # dont display button to change data
        )
      )
    )
  )
)

server <- function(input, output, session) {
  
  data_r <- reactiveValues(data = iris, name = "iris")
  
  observeEvent(input$data, {
    if (input$data == "iris") {
      data_r$data <- iris
      data_r$name <- "iris"
    } else {
      data_r$data <- mtcars
      data_r$name <- "mtcars"
    }
  })
  
  callModule(module = esquisserServer, id = "esquisse", data = data_r)
  
}

shinyApp(ui, server)

Result looks like :

Other exported modules

Some modules used in {esquisse} are exported, so you can use them in your Shiny applications.

Filter data

Module to interactively filter a data.frame and retrieve the code :

Choose data

Module to interactively choose a data.frame in Global environment or to import an external file :

With an external file, import will be performed by package {rio} :

Coerce variable

Coerce a variable from a class to another :

Input widgets

The drag-and-drop widget along with the button to select a geom are exported.

dragulaInput

dropInput