spinstata {Statamarkdown}R Documentation

Convert a specially marked up Stata "do" file to Markdown and HTML.

Description

This function takes a Stata file containing special mark up in it's comments, and converts it to Markdown and HTML documents (or one of several other formats).

Usage

spinstata(statafile, text=NULL, keep=FALSE, ...)

Arguments

statafile

A character string with the name of a Stata "do" file, containing markup in it's comments.

text

A character string in place of a file.

keep

Whether to save intermediate files.

...

options passed to knitr::spin

Details

This function takes a Stata file containing special mark up in it's comments, and converts it into knitr's "spin" format. This is in turn sent to knitr::spin, and converted to Markdown and HTML (or one of several other formats).

Special Markup:

Value

The path to the output file.

If given text instead of a file, returns the compiled document as a character string.

Author(s)

Doug Hemken

See Also

Statamarkdown-package

Examples


## Not run: 
indoc <- "/*'
This is a special Stata script which can be used to generate a report.
You can write normal text in command-style comments.

First we specify a path for Stata and set up some options.
'*/

  /*+  setup +*/
  /*R
library(Statamarkdown)
knitr::opts_chunk$set(engine.path=list(stata=find_stata()), comment=NA)
R*/

  /*' The report begins here. '*/

  /*+  example1, engine='stata' +*/
  sysuse auto
/* Stata comment */
  summarize

/*' You can use the ***usual*** Markdown.'*/
"
x<-spinstata(text=indoc)
writeLines(x, "indoc.html")

## End(Not run)

[Package Statamarkdown version 0.7.1 Index]