I'm trying to set up a shiny vis with two panels.
I would also like, within each panel, to use a fluidPage layout, where I can have columns.
I went ahead and attempted this. But my code isn't working quite right.
I am ending up with one page, where there are 2 tabs, and neither of them work. Further, neither tab has the text that one would expect to be present.
Here is an screenshot of my shiny app. Note the tabs up on the top, which are doing nothing useful:
How can I get the tabs to interact properly? Is there any way to have 2 tabs, and within each tab, use the fluidPage functions to create custom rows and columns?
UI.R
shinyUI(fluidPage(
titlePanel("Shiny Viz!"),
mainPanel(
tabsetPanel(
fluidRow(
column(4,
tabPanel("Controls", checkboxGroupInput("select", label="", choices = list("Age" = "Age", "Weight" = "Weight", "Circumference" = "Circumference"), inline=TRUE))),
column(4,
plotOutput("select"))
))),
tabsetPanel(
fluidRow(
column(4,
tabPanel("output_at_some_point"))))
))
SERVER.R
library(shiny)
library(ggplot2)
DF <- as.data.frame(matrix(c(1:9),ncol=3,nrow=3))
DF <- data.frame(replicate(3,1:3))
names(DF) <- c("Age", "Weight", "Circumference")
shinyServer(function(input, output) {
output$select <- renderPlot({
# modify DF
DF_with_tests_selected <- subset(DF, select = input$select)
#ggplot
p <- ggplot(DF)
p <- p + geom_segment(aes(x=1, xend=1, y=2, yend=3))
plot(p)
})
})
tabsetPanel
.tabsetPanel
can only containtabPanel
elements as members of the tabset. – jdharrisonnavbarPage
andnavbarMenu
is what you are after. – jdharrison