es | R Documentation |
Evaluate R expressions and substitute their values into one or more strings.
es(text, round = NULL, signif = NULL, envir = parent.frame())
text |
A vector of strings to substitute into. |
round |
|
signif |
|
envir |
The environment to evaluate expressions in. |
Each part of the string surrounded by "#{}"
is extracted, evaluated
as R code in the specified environment, and then its value is substituted
back into the string. The literal string "#{}"
can be obtained by
escaping the hash character, viz. "\\#{}"
. The block may contain
multiple R expressions, separated by semicolons, but may not contain
additional braces. Its value will be coerced to character mode, and if the
result has multiple elements then the source string will be duplicated.
The final strings, with expression values substituted into them.
ore_subst
es("pi is #{pi}")
es("pi is \\#{pi}")
es("The square-root of pi is approximately #{sqrt(pi)}", signif=4)
es("1/(1+x) for x=3 is #{x <- 3; 1/(1+x)}")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.