title: tab dependent input for shiny dashboard
body: <p>I am facing an issue with shiny dashboard. I am trying to create a simple dashboard with two tabItems on the left. Each tabItem have their specific set of controls and a plot. But I am probably missing something on the server side to link the input to the tab because the controls of the second tab is behaving strangely. Any help would be much appreciated. Here is my code</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  library(data.table)
  library(ggplot2)
  data = data.table(group = rep(c(1, 3, 6), each = 10), x = rep(1:10, times = 3), value = rnorm(30))
  
  sidebar &lt;- dashboardSidebar(
    sidebarMenu(id = 'sidebarMenu',
      menuItem("tab 1", tabName = "tab1", icon = icon("dashboard")),
      menuItem("tab 2", icon = icon("th"), tabName = "tab2")
    )
  )
  
  body &lt;- dashboardBody(
            tabItems(
              tabItem(tabName = "tab1",
                fluidRow(
                  box(title = "Controls",
                      checkboxGroupInput('group', 'group:', c(1, 3, 6), selected = 6, inline = TRUE), width = 4),
                  box(plotOutput("plot1"), width = 8)
               )
             ),
  
            tabItem(tabName = "tab2",
               fluidRow(
                 box(title = "Controls",
                     checkboxGroupInput('group', 'group:', c(1, 3, 6), selected = 6, inline = TRUE), width = 4),
                 box(plotOutput("plot2"), width = 8)
               )
            )
         )
      )
  
   # Put them together into a dashboardPage
   ui &lt;- dashboardPage(
   dashboardHeader(title = "test tabbed inputs"),
   sidebar,
   body,
   skin = 'green'
   )
  
  server &lt;- function(input, output) {
     output$plot1 &lt;- renderPlot({
     plotData &lt;- data[group %in% input$group]
     p &lt;- ggplot(plotData, aes(x = x, y = value, colour = factor(group))) + geom_line() + geom_point()
     print(p)
     })
     output$plot2 &lt;- renderPlot({
     plotData &lt;- data[group %in% input$group]
     p &lt;- ggplot(plotData, aes(x = x, y = value, colour = factor(group))) + geom_line() + geom_point()
     print(p)
     })
  }
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>When I change input in the first tab it also changes in the second and then when I try to change it back often time nothing happens or it just behaves weirdly. I think I need to specify tie the input to the tabItems somehow but could not find a good example of doing that. Any help would be much appreciated.</p>
  
  <p>Thanks,
  Ashin</p>