Description Usage Arguments Value See Also Examples
View source: R/whisker_mapply.R
Have a mixture of changing and unchanging template elements.
1 | whisker_mapply(template, data = parent.frame(), partials = list(), ...)
|
template |
character |
data |
named list or environment with variables that will be used during rendering but do not change in each |
partials |
See |
... |
named list of object that get substituted
The advantage of this approach are several-fold:
|
character vector of rendered templates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
template <- 'type {{type}}: {{uppercase}},{{lowercase}}'
whisker_mapply( template, list(type="alphabet"), lowercase=letters[1:3], uppercase=LETTERS[1:3] )
# USED IN LOOP ...
# template is pre-defined at top of code (above) and is not changes,
# nor is it required to modify data. This is handled seemlessly.
## Not run:
# for( type in 1:2 ) {
# print( whisker_mapply( template, list(type=type, uppercase="A"), lowercase=letters[1:3] ) )
# }
#
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.