0

I have a selectInpunt updated, and with this last value, I want to get information from a dataframe, but I can't get the value of the last selectInput, I have just the result "character(0)". The dataframe open but I can't get the value corresponding to input...The values of the first selectInput are the names of different data.frames. I can get the data.frame, but I can not extract the information corresponding to the input of the second selectInput.

library(shiny)
liste<-c("BCE","FED")

ui<-tagList(
     navbarPage(
          "Evolutions Economiques",
          tabPanel("Observation",
                   # Application title
                   titlePanel("Evolutions Economiques"),

                   # Sidebar with a slider input for number of bins
                   #sidebarLayout(
                   sidebarPanel(
                        h1("Selection des donnees"),
                        selectInput("Source","Source :",
                                    choices =liste),
                        selectInput("indic","Indicateur :",
                                    choices = NULL)
                   ),

                   # Show a plot of the generated distribution
                   mainPanel(
                        tabsetPanel(type="tabs",
                                    tabPanel("Description",verbatimTextOutput("summary"),
                                    )
                   ))
          )      
))

library(shiny)
library(dplyr)

BCE<-data.frame(Indice=c("A","B"),Description=c("Alors","Pouipoui"))
FED<-data.frame(Indice=c("C","D"),Description=c("So","Birdyy"))

  # Define server logic required to draw a histogram
shinyServer(function(input, output,session) {

     observeEvent(input$Source,{

          data<-get(input$Source)
          updateSelectInput(session,"indic",
                            choices = data$Indice)
     })



      output$summary<-renderPrint({
           data<-get(input$Source)
           data<-filter(data,Indice==input$indic)
           data<-data$Description
           data
      })

})
Aurélien
  • 103
  • 3
  • 12
  • 1
    It's not clear to me what your problem is given your description. Plus your included example has syntax errors (an extra comma after the second `selectInput`), missing libraries (where does `plotlyOutput` come from), and missing data sets (there is no `FED` data.frame). So i'm not sure which part is related to your problem. – MrFlick Sep 06 '18 at 16:56
  • I edited the code... I adapted the code for reproducible example, because my original data.frame come from access database. My problem is to get the column "Description" @MrFlick – Aurélien Sep 07 '18 at 12:34

0 Answers0