我更新了一个 selectInpunt,并且使用最后一个值,我想从数据框中获取信息,但我无法获得最后一个 selectInput 的值,我只有结果“字符(0)”。数据框打开了但是获取不到input对应的值……第一个selectInput的值是不同data.frames的名字。我可以得到data.frame,但是我无法提取第二个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
})
})