Hi,
I've been trying to create a tabsetPanel which depends on some sidebar inputs, avoiding conditionalPanels, by using renderUI and a function to generate the tabPanel code. I gathered from
a post last month that it might be possible but I can't seem to work it! What I have looks roughly like this:
server.R:
output$theTabset <- renderUI({
theOutputs <- returnOutputs(input1, input2, input3)
tabsetPanel(
theOutputs
)
})
ui.R:
...
)
The output of returnOutputs() is a list with each element being the HTML for a tabPanel:
> returnOutputs(1,1,1)
[[1]]
[1] "<div class=\"tab-pane\" title=\"Panel 1\">\n <div id=\"panel1Table\" class=\"shiny-html-output\"></div>\n <div id=\"npanel1Plot\" class=\"shiny-plot-output\" style=\"width: 90% ; height: 500px\"></div>\n</div>"
attr(,"html")
[1] TRUE
[[2]]
[1] "<div class=\"tab-pane\" title=\"Panel 2\">\n <div id=\"panel2Table\" class=\"shiny-html-output\"></div>\n <div id=\"npanel1Plot\" class=\"shiny-plot-output\" style=\"width: 90% ; height: 500px\"></div>\n</div>"
attr(,"html")
[1] TRUE
and I've defined output$panel1Table, output$panel1Plot, etc. in server.R.
Everything except the tabsetPanel renders fine, but I get an error:
Error in if (!grepl(pattern, text)) return(text) :
argument is of length zero
and no tabsetPanel.
I've also tried changing output$theTabset to exclude the tabsetPanel( ) part in server.R and just return theOutputs, and having uiOutput("theTabset") inside a tabsetPanel in ui.R, but that was even less successful.
Does anyone know any solutions to this?
Cheers,
Ben