stata_engine {Statamarkdown}R Documentation

Define a Stata engine for knitr

Description

This function creates a modified Stata engine.

Set up once per session (i.e. document). Ordinarily this is run automatically when Statamarkdown is loaded.

Usage

stata_engine(options)

Arguments

options

options are passed to the engine function when it is actually invoked within knitr.

Details

This function is used as follows.

Value

The language engine function returns Stata code and output internally to knitr.

Author(s)

Doug Hemken

See Also

knit_engines

Examples


indoc <- '
# An R console example
## In a first code chunk, set up with
```{r}
library(Statamarkdown)
```

## Then mark Stata code chunks with
```{stata}
sysuse auto, clear
generate gpm = 1/mpg
summarize price gpm
```
'

if (!is.null(Statamarkdown::find_stata())) {
  # To run this example, remove tempdir().
  fmd <- file.path(tempdir(), "test.md")
  fhtml <- file.path(tempdir(), "test.html")

  knitr::knit(text=indoc, output=fmd)
  rmarkdown::render(fmd, "html_document", fhtml)
}

[Package Statamarkdown version 0.9.2 Index]