hierarchical drop-down list in R shiny

风流意气都作罢 提交于 2020-03-22 07:51:43

问题


We need to create a hierarchical drop-down list in R shiny. The list will have at least 3 levels. Could you please help me in identifying the correct library for this? Please refer the below pic for your reference.Currently we are using the below code.But we are getting incorrect columns in the drop-down.

ui.R
     library(shiny)
    library(shinydashboard)
    library(shinyTree)

shinyUI(
  shiny::fluidPage(
    h3('Countries '),
    shinyTree("tree", checkbox = TRUE),
    verbatimTextOutput("x")


  )
) 
server.R


library(shiny)
library(shinydashboard)
library(shinyTree)
library(treemap)
data(GNI2014)
  head(GNI2014)
GNI2014$pathString <- paste("world", 
                            GNI2014$continent, 
                            GNI2014$country, 
                            sep = "/")
population <- as.Node(GNI2014)
GL<-as.list(population)
shinyServer(function(input, output, session) {  
  output$tree <- renderTree({GL })

  output$x<-renderPrint({input$tree})


}) 

来源:https://stackoverflow.com/questions/47350513/hierarchical-drop-down-list-in-r-shiny

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!