Description Usage Arguments Value Examples
Wrap values in an HTML tag
1 2 3 4 5 6 7 8 |
x |
a vector of values to be wrapped in a tag |
tag |
A character vector of length 1, specifying the html tag (e.g., "div", "h1", "span") |
attr_str |
A character string of the same length as x (or of length 1). |
ignore_na |
If TRUE, do not add tag if value is NA |
span_adjacent |
If TRUE, include adjacent tokens with identical attr_str within the same tag |
doc_id |
If span_adjacent is TRUE, The document ids are required to ensure that tags do not span from one document to another. |
a character vector
1 2 3 4 5 6 7 8 9 10 11 | x = c("Obama","Bush")
add_tag(x, 'span')
## add attributes with the tag_attr function
add_tag(x, 'span',
tag_attr(class = "president"))
## add style attributes with the attr_style function within tag_attr
add_tag(x, 'span',
tag_attr(class = "president",
style = attr_style(`background-color` = 'rgba(255, 255, 0, 1)')))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.