How to display R and Python code in adjacent tabs

I have seen Rmarkdown reports that demonstrate equivalent code in R and Python and allow readers to toggle between R and Python tabs mid document to view the code that interests them. I have unfortunately lost track of the example report and its source code. Can anyone point me towards and example of how to do this?

Hi,

The formatting will be off here, but I think you mean this:

## Results {.tabset}
### Hi
\```{r}
hi <- "hi"
print(hi)
\```

### Bye
\```{r}
bye <- "bye"
print(bye)
\```

Note that the triple "`" prefixed by the backslash should not be prefixed in your code. Source - bottom of this section:
https://rstudio.github.io/cheatsheets/html/rmarkdown.html#write-with-markdown

2 Likes

Thanks for the answer !

For next time : FAQ: How to Format R Markdown Source

1 Like

Thank you! Didn’t know that :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.