"mainPanel" is missing, with no default Shiny error

Hi @apeach86,
Welcome to R! We're glad to have you here.
Shiny can be a pain to navigate because of all the nested parentheses and brackets. I can't fully run your example because you haven't provided reproducible data to go with it, but I fiddled around and it looks like you just your parentheses in the wrong places--you need to add a parenthesis after both selectInput items in the sidebarPanel and remove one from after the mainPanel code.

Can you tell me if this works for you? :

ui <- fluidPage(
      selectInput('xcol', 'X Variable', dimnames(cdc15)[[2]]),
      selectInput('ycol','Y Variable',dimnames(cdc15)[[1]])),
      mainPanel(plotOutput('plot')) ))
server <- function(input, output) {
  selectedData <- reactive({
    Q6[, c(input$xcol, input$ycol)]

If that still doesn't work, could you post some reproducible data so it will be easier to help you answer your question? More information about how to do that here: FAQ: What's a reproducible example (`reprex`) and how do I do one?

Good luck!

1 Like