Skip to contents

Builds an HTML page from what import_stata_smcl() already decodes: one heading per Stata command (its exact syntax, since a .smcl command echo IS the syntax) and one <table> per detected result. Unlike export_jasp_html()/export_omv_html() (which re-export an already-rendered view) or export_spv_html() (which renders decoded charts as images), this has no figures to embed at all: a .smcl file never contains chart image data (see the file header) – a graph export command is shown as recovered command text only.

Usage

export_stata_smcl_html(path, out = NULL)

Arguments

path

path to a .smcl file

out

path to write the HTML file to. Without it, the file is named after path with the extension .html and written to the R session's temporary folder, which R removes when the session ends (CRAN does not allow writing elsewhere unless you ask for it); a message says where.

Value

the path written to, invisibly

Examples

smcl <- tempfile(fileext = ".smcl")
writeLines(c("{smcl}", "{com}. summarize congruent", "",
  "{txt}    Variable {c |}        Obs        Mean    Std. dev.       Min        Max",
  "{hline 13}{c +}{hline 57}",
  "{space 3}congruent {c |}{res}        131    15.10411    4.118164      8.63     27.226",
  "{txt}"), smcl)
html <- export_stata_smcl_html(smcl, file.path(tempdir(), "stata.html"))
file.exists(html)
#> [1] TRUE