tmpl {templates} | R Documentation |
Template constructors
Description
tmpl
is the constructor function for template objects.
Usage
tmpl(.t, ...)
## S3 method for class 'character'
tmpl(.t, ..., .envir = parent.frame())
## S3 method for class 'formula'
tmpl(.t, ...)
## S3 method for class 'tmpl'
tmpl(.t, ...)
## S3 method for class 'function'
tmpl(.t, ...)
Arguments
.t |
something that can be interpreted as template. See defined methods for options. |
... |
(name = value | name ~ value) name-value expressions passed on to tmplUpdate |
.envir |
(environment) the environment in which template snippets are
evaluated. For |
Details
Objects of class tmpl
are stored as a character of length
one. They can contain 'snippets' to be evaluated. These snippets are
identified by an opening {{
and closing }}
. The
environment in which they are evaluated is stored in the object. They can
be further augmented by supplying arguments in ...
.
See Also
Examples
tmpl("Hi {{ toupper(a) }}!", a = "there")
tmpl( ~ {y <- {{ a }}}, a ~ x + 1)
tmpl(function(x) {{ a }} + x, a ~ 1)
[Package templates version 0.4.0 Index]