tag | R Documentation |
Create a tag fragment with optional text and attributes
tag(tag, text = NULL, ..., .attr = list(...))
tag |
character, the name of the tag |
text |
character, the text to include in the tag |
... |
additional attributes to add to the tag |
.attr |
a list of additional attributes to add to the tag, overrides the |
an xml_fragment with the new tag added
tag("greeting", "hi", id = "hi")
tag("person", id = "1") / (tag("name", "John Doe") + tag("age", 35))
xml_fragment(person = frag(
.attr = c(id = 1),
name = "John Doe",
age = 30
)) / tag("address", "Unknown")
a <- tag("person", id = 1) /
xml_fragment(
name ="John Doe",
age = 30,
address = frag(
street = "123 Main St",
city = "Springfield"
)
)
cat(as.character(a))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.