data.frame2xml
Converts a data frame to an XML object which can be written to file using XML::saveXML.
data.frame2nestedList
Converts a data frame to a neste list (used by data.frame2xml
).
list2XML
Converts a list to an XML object.
addAttributes
Function to add attributes. Used in list2XML
.
getVarSetAttr
Utility function for extracting a variable and setting attributes from a data frame. Used in data.frame2nestedList
.
appendToListKeepAttr
Function for appending a list 'add' to another list 'x', while keepeing the list names. Used in data.frame2nestedList
.
extraxtAndSetDotDotAttributes
Function for adding attributes stored in the names, which are ..AttrName.AttrValue. Used in getVarSetAttr
.
setAttributes
Function to set attributes 'att' to object 'x'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | data.frame2nestedList(x, pre = NULL, levelnames = NULL,
rename = NULL, na.rm = FALSE, lastlevel = NULL)
list2XML(node, sublist)
addAttributes(child, l)
getVarSetAttr(x, Attr, Var, pre = NULL, onlyfirst = TRUE,
rename = NULL, na.rm = FALSE)
appendToListKeepAttr(x, add)
extraxtAndSetDotDotAttributes(x)
setAttributes(x, att)
|
x |
The data frame to write to an XML file, validated against the xsd. The data frame has one column per combination of variable and attribute, where the attributes are coded into the column names in the following manner: variableName..attributeName.attributeValue. If there are variables with identical names at different levels in the XMl hierarchy, the level (i.e., the name of the parent node) can be given in the column name by separation of a dot: variableName.level. |
pre |
A nested list to add the nested list to (used in the recursion of |
levelnames |
A vector of names of the levels of the resulting nested list. |
rename |
A list of presentName = newName elements, which rename the columns in the data frame to be converted to a nested list. |
na.rm |
Logical: If TRUE, remove missing values in the XML file (otherwise save these values as NA in the file). |
lastlevel |
The level last processed in the recursion of |
node |
The node to which to append the output from |
sublist |
The list to append to the |
child, l |
The XMl child to add attributes to, and the list from which the attributes are retrieved (used in |
Attr, Var |
Inices of the columns which are variables and attributes at the current level. |
onlyfirst |
Not sure why this is included... |
add |
The list to add to the existinf list. |
att |
A named list of attributes. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.