Search code examples
rr-markdownknitrsjplot

How to use tab_model() within {.tabset} in a r-markdown file


I have problems adding tabsets after using tab_model() within a rmarkdown file, the tabs of the new tabset just get aggregated with the previous tabset.

Does anyone have a walk around this?

Here is a reproducible example

---
title: "R Notebook"
output: html_notebook
---

```{r setup, include=FALSE}
library(sjPlot)
library(magrittr)
library(knitr)
```

## Tab Set 1 {.tabset}

### Tab 1
```{r}
lm(speed~dist, data = cars) %>%
    tab_model() %>% 
    return() %$% 
    knitr %>% 
    asis_output()
```

## Tab Set 2 {.tabset}

### Tab 1
```{r}
plot(cars)
```

image

And this is the desired output without using tab_model().

image


Solution

  • This was an error in the sjPlot package that was solved in the github version.