One of the virtues of processing your dynamic documents through R is that you can use more than one programming language in a single document. Many of us are multi-lingual, and it is often quicker and easier to execute part of a project in one language, while completing your work in another. This is especially common when you are in the process of learning a new language, or if part of your work involves a specialized language with limited capabilities.

Some Setup for Stata

Some initial set up is required to use Stata to process commands. You would include an initial fenced code block (\"code chunk\") to do this. Use the include=FALSE chunk option to hide this from your readers.

```r`r ''`
library(Statamarkdown)
```
library(Statamarkdown)

Then, to switch languages, you just indicate the language in the code fence.

Using Stata

```{stata auto}`r ''`
sysuse auto
regress mpg weight
```

```{stata auto} sysuse auto regress mpg weight

## Using R

````
```r`r ''`
summary(lm(mpg ~ wt, data=mtcars))

````

summary(lm(mpg ~ wt, data=mtcars))


Hemken/Statamarkdown documentation built on Dec. 11, 2023, 3:59 a.m.