Tags down


selectInput is not updated properly in R Shiny

By : Stephanie Cook
Date : October 17 2020, 03:08 PM
I hope this helps . I think your issue is due to repeating dd_options. Per this answer, input identifiers (and output identifiers) cannot be repeated.
Instead, I would use a reactive UI that changes based upon your input$action. I've also consolidated your conditionalPanel.
code :

ui <- fluidPage(theme = shinytheme("spacelab"),
                navbarPage("Structure", id = "allResults",
                           tabPanel(value='action', title='User Actions', 
                                        h4("Select an action"),
                                        radioButtons("action", label = "",
                                                     choices  = list("Action 1"  = 1, 
                                                                     "Action 2" = 2), 
                                                     selected = 1),
                                        actionButton("act_next", "Next!")
                           tabPanel(value='structure', title='Main',

                                            condition = ("input.dd_options == 1 || input.dd_options == 2"), 
                                            selectInput("selectnode", label = "Select a node", choices = ""),
                                            selectInput("selectvar", label = "Select a variable", choices = "")

server <- function(input, output, session) {

    # Update SelectInput
        if (input$action==1) {
            updateSelectInput(session, "selectnode", choices = "Total")
        } else {
            updateSelectInput(session, "selectnode", choices = c('Node 1', 'Node 2', 'Node 3'))

    # Update SelectInput for selectvar
        updateSelectInput(session, "selectvar", choices = c('A','B','C'))
     observeEvent(input$act_next, {
         updateTabsetPanel(session, "allResults", 'structure')

    # reactive UI for dd_options choices 
    output$dd_options <- renderUI({
        if(input$action == 1) {
            choices <- c("Choice 1" = 1,
                         "Choice 2" = 2)
            selected <- 1
        } else if(input$action == 2) {
            choices <- c("Choice 1" = 1,
                         "Choice 2" = 2,
                         "Choice 3" = 3)
            selected <- 3
        selectInput("dd_options", label = "Select one option", 
                    choices = choices, 
                    selected = selected)

shinyApp(ui, server)

Share : facebook icon twitter icon

R Shiny selectInput that is dependent on another selectInput

By : Riaz ur Rehman
Date : March 29 2020, 07:55 AM
To fix the issue you can do You can't access inputs in the ui.R part of the app so you need to use renderUi/uiOutput to dynamically generate your selectInput.
In your ui.R you could add:
code :
 output$secondSelection <- renderUI({
                selectInput("User", "Date:", choices = as.character(dat5[dat5$email==input$Select,"date"]))

How to get value of selectinput and show a variable data in another selectinput with shiny

By : russc
Date : March 29 2020, 07:55 AM
around this issue I want to retrieve the selected value by the user, so i put this code in server.R inside the function , In ui.R, replace your second selectizeInput with
code :
output$snpselect <- renderUI({
  selected_value <- input$valtext
  A <- Filter (catalog, gene_name == selected_value)
  B <- select (A,snp)
    'snpvalue', 'Choisir le snp a visualiser :', choices = B, multiple = TRUE, options = list(maxItems = 2)

Updating a selectInput based on previous selectInput under common server function in R shiny

By : Dali Ghoul
Date : March 29 2020, 07:55 AM
Hope this helps Your code does not work because every time one of the inputs changes, the entire renderUI runs again, thereby resetting all your inputs since they are all created from scratch again!
So how can we work around this? You could try something like the following. Note that I stripped a lot of the unnecessary formatting so it is a bit easier to see how this works.
code :

candyData <- read.table(
  text = "
    Brand       Candy           value
    Nestle      100Grand        Choc1
    Netle       Butterfinger    Choc2
    Nestle      Crunch          Choc2
    Hershey's   KitKat          Choc4
    Hershey's   Reeses          Choc3
    Hershey's   Mounds          Choc2
    Mars        Snickers        Choc5
    Nestle      100Grand        Choc3
    Nestle      Crunch          Choc4
    Hershey's   KitKat          Choc5
    Hershey's   Reeses          Choc2
    Hershey's   Mounds          Choc1
    Mars        Twix            Choc3
    Mars        Vaid            Choc2",
  header = TRUE,
  stringsAsFactors = FALSE)

ui <- fluidPage(
  selectInput("Select2","select2",choices = NULL),
  selectInput("Select3","select3",choices=NULL ))

server <- function(input, output,session) {
           choices=unique(candyData$value[candyData$Brand==input$Select1 & candyData$Candy==input$Select2]))


shinyApp(ui = ui, server = server)

SelectInput Value update based on previous SelectInput in R shiny

By : D.Mendez
Date : March 29 2020, 07:55 AM
will be helpful for those in need The R shiny script below creates three selectInputs such that the values of each selectInput depend upon the input value of the previous selectInput. E.g. in the data in the script, "value" column values depend on "Candy" column and "Candy" column values depend on the "Brand". The issue is that, whether I select "Mars" or "Netle" value in the "Brand" column, The corresponding "Candy" value "100Grand" is same for both, hence I do not see a change in the value column as the selectInput is reading the same value. Kindly help me to fix this, also please ensure the script does not become slow. . , You can just add input$Select1 in your observeEvent to update select3
code :
submenuServ <- function(input, output, session){
    observeEvent(c(input$Select1, input$Select2),{
                          choices=unique(candyData$value[candyData$Brand==input$Select1 &
        session, 'Select3',
        choices= unique(candyData$value[candyData$Brand==input$Select1 & candyData$Candy==input$Select2])

Shiny: create a selectInput after choosing a value of another selectInput

By : Jon Woodward
Date : March 29 2020, 07:55 AM
I wish this help you You can use conditionalPanel(). Below there is a small example which might work in your case.
Related Posts Related Posts :
  • Make a factor variable out of few data.frame columns
  • Overlay overall distribution graph with segment wise distribution
  • Cross product of vector
  • How to store loop output of each iteration to data frame
  • Acquire factors for each level of a character vector
  • can I estimate a time varying seasonal effect in R with GAMM?
  • SD value not showed in dplyr
  • Use milliseconds in variable Time with R
  • Why does R.predict.svm return a list of the wrong size?
  • ggmap + ggplot will not plot certain values
  • How to stop for loop from printing results in R
  • Restructuring DataFrame Based on Single Column Values
  • How to split data.frame to equal columns
  • Replace NAs in vector (A) with specific values from another vector (B) and force the copied value in vector (B) to NAs
  • How to add an in memory png image to a plot?
  • R: Read in random rows from file using fread or equivalent?
  • Use of for loop to delete rows of specific instances in R
  • How to plot the output from an nls model fit in ggplot2
  • Strptime my table gives me NA
  • Melting an R data.table with a factor column
  • Scale circle size Venn diagram by relative proportion
  • How to scrape this links with follow_link in R?
  • Use GET function to run results from a loop
  • How would you run a loop to randomize a community matrix and store them?
  • How to add secondary Y axis in ggplot in R?
  • heatmap with values (ggplot2)--how to make cells square and automatically sized?
  • R piped inner join not working
  • scraping table with rvest (XHR file)
  • Function to return the mean of type numeric
  • Adding a column to custom piped function
  • How to represent categorical variable vs Continuous variable using ggplot?
  • How to Export Each Grouped Table in a List of Tables to a Different Excel Tab Using ReadXL and Tidyverse
  • How to follow group by time
  • Function with a for loop to create a column with values 1:n conditioned by intervals matched by another column
  • Assigning 40 shapes or more in scale_shape_manual
  • install.keras() in RStudio fails with http connection error
  • How to pass a dataframe slice to histogram function for mode normalisation in R?
  • How to manipulate a community diversity profile
  • r igraph - Identify ties of nodes to a subgraph regardless of affiliation to said subgraph
  • Display a rectangle in ggplot with x axis in date format
  • Merging two Dataframes in R by ID, One is the subset of the other
  • How do I apply conditions on a particular group element and find permutations from another group in the same table?
  • how to add into an existing column from another column in R
  • fileInput not returning any dataframe
  • Change dataframe values R using different column name provided?
  • error calling combine function loop foreach in R
  • Find mean for sorted top n transactions
  • Finding the largest number in a vector which is smaller than specific value
  • Create a list name column in a list of data frames
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com