How to select a specific tab in R Markdown?

The {.active} attribute could answer your question when launching the dashboard (static solution), and works with html_document :

---
title: "Active Tabset"
output: html_document
---
    

Column {.tabset}
-------------------------------------
   
### Tab 1

Some text
 
### Tab 2 {.active}

Some other text

enter image description here

Unfortunately, this didn't work with Flexdashboard :

---
title: "Active Tabset"
output: flexdashboard::flex_dashboard
---
    

Column {.tabset}
-------------------------------------
   
### Tab 1

Some text
 
### Tab 2 {.active}

Some other text

enter image description here

The issue has already been signaled here but was closed because of automatic lock.
The waiting period in order to comply with RMarkdown issue guide being over, I filed a new issue with the Minimal Reproducible Example above.

EDIT : This request has been taken into account, so this should soon work with Shiny Dashboard.


Instead of an observeEvent you could wrap the actionButton itself in an tags$a and link to #section-mytab. Note that you have to add section- before the tab name when using runtime: shiny.

Does this solve your problem or do you need it to work with observeEvent?

---
title: "Tabset Column"
output: flexdashboard::flex_dashboard
runtime: shiny
---

Column 
-------------------------------------
  
### Chart 1
  
```{r, echo = FALSE}
tags$a(href = "#section-mytab",
  shiny::actionButton("btn1", "go to mytab")
       )
```

Column {.tabset}
-------------------------------------
    
### Chart 2

```{r}

```   
  
### Chart 3 {#mytab}
  
```{r}

```

If needed, the logic above can be combined with observeEvent using {shinyjs} and a non-visible actionButton. The trick is here, that we still use an actionButton to trigger the tab. But the actual button is not shown display: none (it is important, that the button is not set to hidden, since this will prevent it from being clicked). We then create another actionButton which is observed by an observeEvent. This can trigger other calculations etc. and finally a click on the actionButton which is not shown. If you have more pages and want to jump from page 1 to, say, tab 3 on page 2, then we would need two clicks: one changing the page and one activating the tab. But we can all trigger this inside the observeEvent. Its hacky and doesn't look like good code, but on the plus side it works, even without a custom javascript function.

---
title: "Tabset Column"
output: 
flexdashboard::flex_dashboard
runtime: shiny
---

```{r global, echo = FALSE}
library(shiny)
library(shinyjs)
useShinyjs(rmd = TRUE)
```


Column 
-------------------------------------
  
### Chart 1

```{r, echo = FALSE}
observeEvent(input$btn1, {
  # do some calculations here
  click("btn2")})
 
shiny::actionButton("btn1", "do something")

tags$a(href = "#section-mytab",
  # set this button to `display: none;` but *not* to `hidden`
  shiny::actionButton("btn2", "go to mytab", style = "display: none")
  )
```

Column {.tabset}
-------------------------------------

### Chart 2

```{r}

```   
  
### Chart 3 {#mytab}
  
```{r}

```