tmpl: Template constructors

Description Usage Arguments Details See Also Examples

View source: R/templates.R

Description

tmpl is the constructor function for template objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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 formulas and functions their environment is used.

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

tmplUpdate, tmplEval

Examples

1
2
3
tmpl("Hi {{ toupper(a) }}!", a = "there")
tmpl( ~ {y <- {{ a }}}, a ~ x + 1)
tmpl(function(x) {{ a }} + x, a ~ 1)

templates documentation built on May 2, 2019, 8:33 a.m.