Module for choosing data.frame from user environment and select variable to use.

chooseDataUI(id, label = "Data", icon = "database", ...)

chooseDataServer(input, output, session, dataModule = c("GlobalEnv",
  "ImportFile"), data = NULL, name = NULL, selectVars = TRUE,
  coerceVars = FALSE, launchOnStart = TRUE, size = "m")

Arguments

id

Module's id.

label

Button's label.

icon

Button's icon.

...

Arguments passed to actionButton

input, output, session

standards shiny server arguments.

dataModule

Data module to use, choose between "GlobalEnv" (select ad data.frame from Global environment) or "ImportFile" (import an external file supported by import).

data

A data.frame to use by default.

name

Character, object's name to use for data.

selectVars

Display module to select variables, TRUE by default.

coerceVars

Display module to coerce variables between different class, TRUE by default.

launchOnStart

Opens modal window when the application starts.

size

Size for the modal window.

Value

a reactiveValues containing the data selected under slot data and the name of the selected data.frame under slot name.

Examples

if (interactive()) { library(shiny) library(esquisse) ui <- fluidPage( tags$h2("Choose data module"), fluidRow( column( width = 4, tags$h4("Default"), chooseDataUI(id = "choose1"), verbatimTextOutput(outputId = "res1") ), column( width = 4, tags$h4("No var selection"), chooseDataUI(id = "choose2"), verbatimTextOutput(outputId = "res2") ), column( width = 4, tags$h4("Default data on start"), chooseDataUI(id = "choose3"), verbatimTextOutput(outputId = "res3") ) ) ) server <- function(input, output, session) { res_dat1 <- callModule( chooseDataServer, id = "choose1", launchOnStart = FALSE ) output$res1 <- renderPrint({ str(reactiveValuesToList(res_dat1)) }) res_dat2 <- callModule( chooseDataServer, id = "choose2", selectVars = FALSE, launchOnStart = FALSE ) output$res2 <- renderPrint({ str(reactiveValuesToList(res_dat2)) }) res_dat3 <- callModule( chooseDataServer, id = "choose3", data = iris, launchOnStart = FALSE ) output$res3 <- renderPrint({ str(reactiveValuesToList(res_dat3)) }) } shinyApp(ui, server) }