0
我想做一個選擇學校的菜單。但是學校嵌在城市裏,這個在部門裏,所以我需要在三個下拉列表中列出。此代碼適用於部門和城市。但是,當我爲學校擴大它給了我一個錯誤R中三個級別的下拉列表
感謝
require(shiny)
datas <- data.frame(directory = c(puntaje_2016_1$estu_reside_depto), file = c(puntaje_2016_1$estu_reside_mcpio) , cole = c(puntaje_2016_1$cole_nombre_sede))
runApp(list(
ui = basicPage(
sidebarPanel(
selectInput("directory", "Select a directory", choices = levels(datas$directory), selected = levels(datas$directory)[1]),
tags$hr(),
selectInput("files", "Select files", choices = datas$file[datas$directory == levels(datas$directory)[1]], multiple = FALSE)
## tags$hr()
##selectInput("cole", "Select files", choices = datas$cole[datas$file == levels(datas$file)[1]], multiple = FALSE)
)
),
server = function(input, output, session) {
observe({
directory <- input$directory
updateSelectInput(session, "files", choices = datas$file[datas$directory == directory])
})
##observe({
##files<-input$files
##updateSelectInput(session, "coles", choice = datas$cole[datas$file == ##files])
## })
}
))
感謝您的時間。只有在10行中缺少幾個逗號,我邀請你來幫我這個 https://stackoverflow.com/questions/45693153/how-to-create-interactive-dummy-in-shiny –