Statamarkdown returns no result
library(Statamarkdown) Stata found at /usr/local/bin/stata-mp The 'stata' engine is ready to use. example("stata_engine", package="Statamarkdown")
stt_ng> indoc <- '
stt_ng+ # An R console example
stt_ng+ ## In a first code chunk, set up with
stt_ng+ {r} stt_ng+ library(Statamarkdown) stt_ng+
stt_ng+
stt_ng+ ## Then mark Stata code chunks with
stt_ng+ {stata} stt_ng+ sysuse auto, clear stt_ng+ generate gpm = 1/mpg stt_ng+ summarize price gpm stt_ng+
stt_ng+ '
stt_ng> if (!is.null(Statamarkdown::find_stata())) { stt_ng+ # To run this example, remove tempdir(). stt_ng+ fmd <- file.path(tempdir(), "test.md") stt_ng+ fhtml <- file.path(tempdir(), "test.html") stt_ng+ stt_ng+ knitr::knit(text=indoc, output=fmd) stt_ng+ rmarkdown::render(fmd, "html_document", fhtml) stt_ng+ } Stata found at /usr/local/bin/stata-mp
/usr/lib/rstudio/resources/app/bin/quarto/bin/tools/x86_64/pandoc +RTS -K512m -RTS test.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /tmp/Rtmphanmks/test.html --lua-filter /home/xao/R/x86_64-pc-linux-gnu-library/4.4/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/xao/R/x86_64-pc-linux-gnu-library/4.4/rmarkdown/rmarkdown/lua/latex-div.lua --embed-resources --standalone --variable bs3=TRUE --section-divs --template /home/xao/R/x86_64-pc-linux-gnu-library/4.4/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/Rtmphanmks/rmarkdown-str4f63445fc7de.html [WARNING] This document format requires a nonempty
Output created: /tmp/Rtmphanmks/test.html Warning message: In min(grep("[[:alnum:]]", y)) : no non-missing arguments to min; returning Inf
Please read the text in the example carefully.
As indicated in the comment, to save the output files from that example, you need to remove the calls to tempdir().
Here is the code with the tempdir() calls removed.
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())) {
fmd <- file.path("test.md")
fhtml <- file.path("test.html")
knitr::knit(text=indoc, output=fmd)
rmarkdown::render(fmd, "html_document", fhtml)
}
When you run it, you will find both test.md and test.html created in your working directory.
The test.html file looks like this
Hope this helps.