Hi everyone!
I am making a shiny app and I would like to change the way the tree is collapsed according to the choice of the user in a picker input.
In other words, the same thing that happens when you click the tree - I would like to do that with a shiny input.
Any ideas?
library(shiny)
library(collapsibleTree)
Verbes <- data.frame(
Verbes = c('Etre', 'Avoir', '-ER', '-ER', '-ER', 'IR', 'IR', 'IR'),
sg1 = c(NA, NA, 'Manger' , 'Dancer', 'Parler', '-TIR', '-TIR','-OIR'),
sg2 = c(NA, NA, NA, NA, NA, 'PARTIR', 'SORTIR','BOIRE')
)
ui <- fluidPage(
mainPanel(
selectizeInput(
"hierarchy", "Tree hierarchy",
choices = c('Etre', 'Avoir', 'Manger' , 'Dancer', 'Parler', 'PARTIR', 'SORTIR','BOIRE')
),
hr(),
collapsibleTreeOutput("tree")
)
)
server <- function(input, output, session) {
output$tree <- renderCollapsibleTree({
collapsibleTreeSummary(
Verbes ,
hierarchy = c("Verbes", "sg1", "sg2"),
width = 800,
collapsed = F
)
})
}
shinyApp(ui = ui, server = server)