fill_template: Assign names to slots in a string

Description Usage Arguments Examples

View source: R/fill_template.R

Description

Slots are identified by the usual {{name}} convention. One use for this is constructing formulas from input text strings in a manipulate or shiny app

Usage

1
fill_template(template_str, ...)

Arguments

template_str

a character string with named slots, e.g. "{{person}} is {{age}} years old."

...

values for the slots, e.g. person = Bill, age = 12

Examples

1
2
fill_template("{{person}} is {{age}} years old.", person = "Bill", age = 12 )
as.formula(fill_template("{{y}} ~ {{x}} - 1", x = "height", y = "age"))

dtkaplan/mdsint documentation built on May 28, 2019, 7:55 p.m.