tools/prepare-tutorials.R

# Extract the executable tutorial scripts from their single R Markdown sources.
# Usage: Rscript tools/prepare-tutorials.R /path/to/IJSE
args <- commandArgs(trailingOnly = TRUE)
stopifnot(length(args) == 1L)
root <- normalizePath(args[1L], mustWork = TRUE)
names <- c("ijse", "ijse-brms", "ijse-diagnostics")
output <- file.path(root, "inst", "tutorials")
dir.create(output, recursive = TRUE, showWarnings = FALSE)
for (name in names) {
  input <- file.path(root, "vignettes", paste0(name, ".Rmd"))
  headers <- grep("^```\\{", readLines(input), value = TRUE)
  stopifnot(all(grepl("\\}$", headers)))
  knitr::purl(input, output = file.path(output, paste0(name, ".R")),
              documentation = 0L, quiet = TRUE)
}

Try the IJSE package in your browser

Any scripts or data that you put into this service are public.

IJSE documentation built on Oct. 22, 2026, 5:18 p.m.