How's this for a starting point...
---
title: "Test"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, error = TRUE)
```
```{r}
library(details)
```
# Foo {.tabset .tabset-fade .tabset-pills}
## R Code
```{details}
summary(cars)
```
## Stata Code
```
regress y x
```