Description Usage Arguments Details Author(s) Examples
Simple variable interpolation in texts
1 | qq(..., envir = parent.frame(), code.pattern = NULL, collapse = TRUE, sep = " ")
|
... |
Text string in which variables are marked with certain rules |
envir |
Environment where to look for variables. By default it is the environment where |
code.pattern |
Pattern of marks for the variables. By default it is |
collapse |
If variables return vector of length larger than one, whether collapse into one string or return a vector |
sep |
Separator character when there are multiple templates. |
I like variable interpolation in Perl. But in R, if you want to concatenate plain text and variables,
you need to use functions such as paste
. However, if there are so many variables, quotes, braces
in the string you want to construct, it would be painful.
This function allows you to construct strings as in Perl style. Variables are
marked in the text with certain rule. qq
will look up these variables in user's
environment and replace the variable marks with their real values.
For more explaination of this function, please refer to vignette.
Zuguang Gu <z.gu@dkfz.de>
1 2 3 4 5 6 7 8 9 10 11 |
[1] "a = 1, b = 'text'"
[1] "a = 1, b = 'text'"
[1] "a = 1, b = 'text'a = 2, b = 'text'"
[1] "a = 1, b = 'text'" "a = 2, b = 'text'"
[1] "a = 1, b = 'text'"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.