replace_html {tableHTML} | R Documentation |
Replaces a tableHTML string with another
Description
replace_html
replaces a tableHTML string with another
Usage
replace_html(tableHTML, pattern, replacement, replace_all = FALSE, ...)
Arguments
tableHTML |
A tableHTML object created by the tableHTML function. |
pattern |
A tableHTML string to be replaced. Regex is allowed. |
replacement |
A replacement for the matched pattern. |
replace_all |
TRUE or FALSE. If TRUE gsub is used internally and all the pattern occurrances will be replaced. If FALSE sub is used internally and only the first occurance will be replaced. Defaults to FALSE. |
... |
Additional arguments passed on to sub or gsub. |
Details
replace_html
replaces a tableHTML string with another. The function calls sub and gsub
internally (according to the replace_all argument) to do the replacements but in a safe way in
order to preserve the class of the tableHTML object. Also, replace_html
has been
developed so that it can be used with chaining (using the pipe operator %>%).
See the examples to understand exactly how.
Value
A tableHTML object.
See Also
Examples
a <- mtcars %>%
tableHTML() %>%
add_css_row(css = list('background-color', 'lightblue'), rows = 1)
a %>%
replace_html('lightblue', 'green')