Description Usage Arguments Examples
Writing strings for messages with variable content often involves a mess of
nested calls to paste
. Use this function to reduce the clutter created by these.
Lifted from https://github.com/robertzk/productivus/blob/master/R/pp.R
1 | pp(..., envir = parent.frame(), sep = "", collapse = "")
|
... |
a character vector, or a (possibly nested) list of character vectors. |
envir |
environment. The environment to fetch values to use in interpolation. |
sep |
character. Passed into the |
collapse |
character. Passed into the |
1 2 3 4 5 6 7 8 9 10 | ## Not run:
x <- 5
pp("we assigned ${x} to x")
x <- "this time we'll use a string"
pp("we assigned ${x} to x, and the value of x changed")
.small_env <- new.env()
.small_env$x <- "this is inside an environment"
pp("if we declare an environment, we see that x is ${x} there", envir = .small_env)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.