Posts

Showing posts from November, 2020

Converting XML data to R dataframes with xmlconvert

Image
The  xmlconvert  package is made to easily and comfortably convert XML data to R dataframes and the other way around. It provides a lot of options to control the conversion process and to export the results to CSV or Excel files, if desired. How you install  xmlconvert Just execute  install.packages ("x mlconvert", dependencies = TRUE)  in the R console to install the package including all packages it depends on. By default, the  xlsx  package for writing Excel files is not installed together with  xmlconvert .  xmlconvert  will tell you when you need  xlsx  and will ask you to install it then. How you work with  xmlconvert The functions  xml_to_df()  and  df_to_xml()  are the two workhorses of the package. The functions assume that each data record (e.g. a customer) in the XML data is stored in one XML element/tag; the individual fields (e.g. name, address, e-mail), however, can be represented in different ways. An XML data file could like this: When working with the  xml_to