addChildren() adds one or more children to a standard DDI Codebook element
(see makeElement), anyChildren() checks if an element has any
children at all, hasChildren() checks if the element has specific children,
indexChildren() returns the positions of the children among all containing
children, and getChildren() extracts them. For attributes and content,
there are dedicated functions to add*(), remove*() and change*().
addChildren(children, to, overwrite = TRUE, ...)anyChildren(element)
getChildren(xpath, from, ...)
hasChildren(element, name)
indexChildren(element, name)
removeChildren(name, from, overwrite = TRUE, ...)
addContent(content, to, overwrite = TRUE)
makePath(xpath, from, overwrite = TRUE, ...)
moveChild(xpath, from, to, overwrite = TRUE, ...)
replaceChild(xpath, with, overwrite = TRUE, ...)
changeContent(content, to, overwrite = TRUE)
removeContent(from, overwrite = TRUE)
addAttributes(attrs, to, overwrite = TRUE)
anyAttributes(element)
changeAttributes(attrs, from, overwrite = TRUE)
hasAttributes(element, name)
removeAttributes(name, from, overwrite = TRUE)
An invisible standard DDI element. Functions any*() and has*()
return a logical (vector).
A standard element of class "DDI", or a list of such elements.
A standard element of class "DDI", or an xpath string pointing
to a target element.
Logical, overwrite the original object in the parent frame.
Other arguments, mainly for internal use.
A standard element of class "DDI".
Character, an xpath to a DDI Codebook element. Indexed segments
are supported using square brackets, e.g. codeBook/dataDscr/var[3].
Missing indexes default to the first matching element.
A standard element of class "DDI", or an xpath string pointing
to a target element.
Character, name(s) of specific child element / attribute.
Character, the text content of a DDI element.
A standard element of class "DDI", or an xpath string pointing
to a target element.
A list of specific attribute names and values.
Adrian Dusa
Although an XML list generally allows for multiple contents, sometimes spread
between the children elements, it is preferable to maintain a single content
(eventually separated with carriage return characters for separate lines).
XPath resolution accepts indexed segments using [n]. When an index is
missing, the first matching element is selected.
Arguments are unique, and can be changed by simply referring to their names.
Elements can be repeated. For example, dataDscr contains one var element
per dataset variable. When multiple var elements exist, referring only to
the name is ambiguous. Use indexed xpaths like var[3] to target a specific
instance, or use indexChildren() to list all positions for iteration.
If more than one children, they should be grouped into a list.
Functions addContent, changeContent, removeContent, addAttributes,
changeAttributes, and removeAttributes accept either a standard DDI element
or a character xpath. When an xpath is provided, the target element is
resolved and replaced in the root element.