Module for choosing data.frame from user environment and select variable to use.
chooseDataUI(id, label = "Data", icon = "database", width = "100%", ...) chooseDataServer( input, output, session, dataModule = c("GlobalEnv", "ImportFile"), data = NULL, name = NULL, selectVars = TRUE, selectedTypes = c("continuous", "discrete", "time"), coerceVars = FALSE, launchOnStart = TRUE, size = "m" )
| id | Module's id. |
|---|---|
| label | Label for button, passed to |
| icon | Icon to appears on the button, passed to |
| width | Width of button, passed to |
| ... | Other arguments passed to |
| input, output, session | standards |
| dataModule | Data module to use, choose between |
| data | A |
| name | Character, object's name to use for |
| selectVars | Display module to select variables, |
| selectedTypes | Type of variables selected by default in select variables module.
Possible types are |
| coerceVars | Display module to coerce variables between different class, |
| launchOnStart | Opens modal window when the application starts. |
| size | Size for the modal window. |
a reactiveValues containing the data selected under slot data
and the name of the selected data.frame under slot name.
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 variable 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) }