Fetching contributors…
Cannot retrieve contributors at this time
38 lines (34 sloc) 1.21 KB
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/template.R
\title{A simple macro preprocessor for templating purposes}
knit_expand(file, ..., text = readLines(file, warn = FALSE), delim = c("{{", "}}"))
\item{file}{the template file}
\item{...}{a list of variables to be used for the code in the template; note
the variables will be searched in the parent frame as well}
\item{text}{an alternative way to \code{file} to specify the template code
directly (if provided, \code{file} will be ignored)}
\item{delim}{the (opening and ending) delimiters for the templating tags}
A character vector, with the tags evaluated and replaced by their
This function expands a template based on the R expressions in \code{{{}}}
(this tag can be customized by the \code{delim} argument). These expressions
are extracted, evaluated and replaced by their values in the original
# see the knit_expand vignette
if (interactive()) browseVignettes(package = "knitr")
This function was inspired by the pyexpander and m4
(\url{}), thanks to Frank Harrell.