diff --git a/server.r b/server.r index acbbf26..14a235c 100644 --- a/server.r +++ b/server.r @@ -169,40 +169,20 @@ shinyServer(function(input, output, session){ # 1. FILE INPUT # ################################################################ + + observeEvent(input$loadFileType, { - if(input$loadFileType == "Auto"){ - updateRadioButtons(session, "loadDecimalSeparator", - label = h4("File format"), - choices = list("Auto detect" = "Auto", "Dot (.)" = ".", "Comma (,)" = ","), - selected = "Auto" - ) - } - - if(input$loadFileType == "csv"){ - updateRadioButtons(session, "loadDecimalSeparator", - label = h4("File format"), - choices = list("Dot (.)" = "."), - selected = "." - ) - } - - if(input$loadFileType == "tsv"){ - updateRadioButtons(session, "loadDecimalSeparator", - label = h4("File format"), - choices = list("Auto detect" = "Auto", "Dot (.)" = ".", "Comma (,)" = ","), - selected = "Auto" - ) - } + if(input$loadFileType == "Auto") x <- list("Auto detect" = "Auto", "Dot (.)" = ".", "Comma (,)" = ",") + if(input$loadFileType == "csv") x <- list("Dot (.)" = ".") + if(input$loadFileType == "tsv") x <- list("Auto detect" = "Auto", "Dot (.)" = ".", "Comma (,)" = ",") + if(input$loadFileType == "xlsx") x <- list("Auto detect" = "Auto") - if(input$loadFileType == "xlsx"){ - updateRadioButtons(session, "loadDecimalSeparator", - label = h4("File format"), - choices = list("Auto detect" = "Auto"), - selected = "Auto" + updateRadioButtons(session, "loadDecimalSeparator", + label = "Decimal separator", + choices = x, + selected = x[[1]] ) - } - }) observeEvent(input$file1, { diff --git a/ui.r b/ui.r index cb94067..9018c68 100644 --- a/ui.r +++ b/ui.r @@ -24,7 +24,7 @@ shinyUI(navbarPage("shinyHTM", choices = list("Auto detect" = "Auto", "Comma separated (csv)" = "csv", "Tab separated (txt)" = "tsv", "Excel (xlsx)" = "xlsx"), selected = "Auto"), br(), - radioButtons("loadDecimalSeparator", label = h4("Decimal separator"), + radioButtons("loadDecimalSeparator", label = "Decimal separator", choices = list("Auto detect" = "Auto", "Dot (.)" = ".", "Comma (,)" = ","), selected = "Auto") )