| DDI-children | R Documentation |
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)
children |
A standard element of class |
to |
A standard element of class |
overwrite |
Logical, overwrite the original object in the parent frame. |
... |
Other arguments, mainly for internal use. |
element |
A standard element of class |
xpath |
Character, an xpath to a DDI Codebook element. Indexed segments
are supported using square brackets, e.g. |
from |
A standard element of class |
name |
Character, name(s) of specific child element / attribute. |
content |
Character, the text content of a DDI element. |
with |
A standard element of class |
attrs |
A list of specific attribute names and values. |
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.
An invisible standard DDI element. Functions any*() and has*()
return a logical (vector).
Adrian Dusa
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.