View source: R/S05-dimensions_and_text.R
replace_with_values | R Documentation |
Replaces placeholder text in a character vector with user specified values.
replace_with_values( x, values, placeholder = function(i) { paste0("[[", i, "]]") }, ... )
x |
A character vector |
values |
A vector of values with which to replace placeholder text. |
placeholder |
A function defining
how to identify placeholder text based
on the index position of the vector
|
... |
Additional parameters for the
|
# Character vector with placeholder text # '[[i]]' for the ith element to replace x <- c( 'Value: [[1]]', 'Value: [[2]]' ) replace_with_values( x, c( 1, 2 ) ) # Custom function to replace different # placeholder text placeholder <- function( i ) paste0( '***', LETTERS[i] ) x <- c( 'Value: ***A', 'Value: ***B' ) replace_with_values( x, c( 1, 2 ), placeholder )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.