Learn R Programming

openxlsx2 (version 1.4)

xml_node_create: create xml_node from R objects

Description

takes xml_name, xml_children and xml_attributes to create a new xml_node.

Usage

xml_node_create(
  xml_name,
  xml_children = NULL,
  xml_attributes = NULL,
  escapes = FALSE,
  declaration = FALSE
)

Arguments

xml_name

the name of the new xml_node

xml_children

character vector children attached to the xml_node

xml_attributes

named character vector of attributes for the xml_node

escapes

bool if escapes should be used

declaration

bool if declaration should be imported

Details

if xml_children or xml_attributes should be empty, use NULL

Examples

Run this code
xml_name <- "a"
# ""
xml_node_create(xml_name)

xml_child <- "openxlsx"
# "openxlsx"
xml_node_create(xml_name, xml_children = xml_child)

xml_attr <- c(foo = "baz", qux = "quux")
# ""
xml_node_create(xml_name, xml_attributes = xml_attr)

# "openxlsx"
xml_node_create(xml_name, xml_children = xml_child, xml_attributes = xml_attr)

Run the code above in your browser using DataLab