fxml_toXML {flatxml}R Documentation

Converting between XML and dataframes

Description

Converts a dataframe to XML.

Usage

fxml_toXML(
  df,
  filename = NULL,
  element.tag = "record",
  indent = "\t",
  line.break = "\n",
  return.xml = FALSE
)

Arguments

df

The dataframe to be converted (also works with tibbles and the like)

filename

Name of the file to which the XML will be saved; default is NULL meaning no file is produced

element.tag

The tag name of the XML element that will carry the data (see example)

indent

Character(s) used for indentation to make the XML prettier; tabulator ("\t") by default ("" will lead to no indentation)

line.break

Character(s) that is written at the end of each line of the XML (line break "\n" by default)

return.xml

If TRUE, the XML will be returned by the function; so you can decide if you want the function write a file, or just return the XML code, or both.

Value

If return.xml == TRUE the XML code is returned. If filename is not NULL then the XML is (additionally) written to the specified file.

Author(s)

Joachim Zuckarelli joachim@zuckarelli.de

See Also

fxml_toDataFrame

Examples

mydata<-data.frame(list(var1 = c("a", "b", "c"), var2 = c(1,2,3)))
fxml_toXML(mydata, return.xml = TRUE)


[Package flatxml version 0.1.1 Index]