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)
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"
.
Logical, overwrite the original object in the parent frame.
Other arguments, mainly for internal use.
A standard element of class "DDI"
.
Character, a path to a DDI Codebook element.
A standard element of class "DDI"
.
Character, name(s) of specific child element / attribute.
Character, the text content of a DDI 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).
Arguments are unique, and can be changed by simply referring to their names.
Elements, however, can be repeated. For instance element var
to describe
variables, within the dataDscr
(data description) sub-element in the
codeBook
. There are as many such var
elements as the number of variables
in the dataset, in which case it is not possible to change a specific var
element by referring to its name. For this purpose, it is useful to extract
the positions of all var
elements to iterate through, which is the purpose
of the function indexChildren()
.
Future versions will allow deep manipulations of child elements using the
xpath
argument.
If more than one children, they should be grouped into a list.