Description Usage Arguments Value Examples
Module for choosing data.frame from user environment and select variable to use.
1 2 3 4 5 | chooseDataUI(id, label = "Data", icon = "database", ...)
chooseDataServer(input, output, session, dataModule = c("GlobalEnv",
"ImportFile"), data = NULL, name = NULL, selectVars = TRUE,
launchOnStart = TRUE, size = "m")
|
id |
Module's id. |
label |
Button's label. |
icon |
Button's icon. |
... |
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, |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.