title: How to Switch Between NavBar Tabs with a Button R Shiny
body: <p>I need the user to click a button and be taken to a different <code>tabPanel</code> of a <code>navbarPage</code>. Here is a simple app where this could be implemented. How can I achieve this?</p>
  
  <pre><code>ui &lt;- shinyUI(
   navbarPage('Test App',
    tabPanel('Page 1',
     p('This is the first tab'), br(),
     actionButton('jumpToP2', 'Jump to Second Tab')
    ),
  
    tabPanel('Page 2',
     p('This is the second tab'),
     actionButton('jumpToP1', 'Jump to First Tab')
    )
   )
  )
  
  server &lt;- shinyServer(function(input, output){
    observeEvent(input$jumpToP2,{
      ## Switch active tab to 'Page 2'
    })
  
    observeEvent(input$jumpToP1,{
      ## Switch active tab to 'Page 1'
    })
  })
  
  shinyApp(ui, server)
  </code></pre>