text_expand {maditr} | R Documentation |
Evaluate expressions in curly brackets inside strings
Description
text_expand
is simple string interpolation function. It searches in its
arguments expressions in curly brackets {expr}
, evaluate them and substitute with
the result of evaluation. See examples.
Usage
text_expand(..., delim = c("\\{", "\\}"))
Arguments
... |
character vectors |
delim |
character vector of length 2 - pair of opening and closing
delimiters for the templating tags. By default it is curly brackets. Note
that |
Value
Vector of characters
Examples
i = 1:5
text_expand("q{i}")
i = 1:3
j = 1:3
text_expand("q1_{i}_{j}")
data(iris)
text_expand("'iris' has {nrow(iris)} rows.")
[Package maditr version 0.8.4 Index]