Last active
December 14, 2020 14:20
-
-
Save ijlyttle/6230575 to your computer and use it in GitHub Desktop.
demonstration of attempt to get `conditionalPanel` to work on a file-upload condition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyServer(function(input, output) { | |
# Has a file been imported? | |
output$csv_import_ready <- reactive({ | |
return(!is.null(input$csv_import_file)) | |
}) | |
# SOLUTION (2013-08-17) | |
# activate the output so it runs although not displayed | |
# ref: https://groups.google.com/forum/#!msg/shiny-discuss/S15Vp7P72eg/yNv_O-axrd8J | |
outputOptions(output, "csv_import_ready", suspendWhenHidden = FALSE) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyUI(pageWithSidebar( | |
# Application title | |
headerPanel("Ian's very boring app"), | |
sidebarPanel( | |
# File Import | |
fileInput(inputId="csv_import_file", | |
label="Import CSV File", | |
accept=c("text/csv", "text/comma-separated-values", | |
"text/plain")), | |
# Theory: Show this only when file has been imported | |
# | |
# Practice: Not shown when file has been uploaded | |
conditionalPanel( | |
condition="output.csv_import_ready", | |
checkboxInput(inputId="do_something", label="OK, now do something!") | |
) | |
), | |
mainPanel() | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have one question, if I replace checkboxGroupInput by checkboxInput in ui.R, and I want to show that choices = names(data), selected =names(data). How could I program it, thank you.