Description Usage Arguments Value See Also Examples
Converts dataframes to XML documents.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
df |
Dataframe to be converted to XML |
fields |
A character value, either |
record.tag |
Name of the tags that will represent the data records in the resulting XML (i.e. each record has one element with this tag name). |
field.names |
Names of the fields in the XML file. If |
only.fields |
Optional vector variable names from the dataframe that
will be included in the XML document. If |
exclude.fields |
Optional vector of variable names from the dataframe that will not be included in the XML document. |
root.node |
A character value with the desired name of the root element
of the XML document; |
xml.file |
Name of a file the XML document it written to. If |
non.exist |
Value that will be written into the XML document as field
value in case the respective element in the dataframe is |
encoding |
Encoding of the XML document; default is |
no.return |
Logical option to prevent |
The resulting XML document that be edited with the functions from the
xml2 package. There is no return value if the no.return
argument is set to TRUE
.
Other xmlconvert:
xml_to_df()
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Create a dataframe
soccer.worldcups <- data.frame(list(year=c(2014, 2010, 2006),
location=c("Brazil", "South Africa", "Germany"),
goals_scored=c(171, 145, 147),
average_goals=c(2.7, 2.3, 2.4),
average_attendance=c(57918, 49669,52491)),
stringsAsFactors = FALSE)
# Convert to XML with the fields (i.e. dataframe variables/columns) stored in XML tags
xml <- df_to_xml(soccer.worldcups, fields="tags", record.tag = "worldcup")
# Convert to XML with the fields (i.e. dataframe variables/columns) stored in attributes
xml <- df_to_xml(soccer.worldcups, fields="tags", record.tag = "worldcup")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.