Skip to content

Latest commit

 

History

History
24 lines (12 loc) · 1.16 KB

XMLinR.md

File metadata and controls

24 lines (12 loc) · 1.16 KB

Dealing with XML in R

XML isn't as easy to deal with as it should be in R. Although there is an XML package, it is not straightforward to use, and worse, XML files rarely play nice with it either.

In reality, then, there are a variety of ways to handle XML files depending on the problems they represent. This page documents those I've come across so far.

First, install XML: install.packages('XML') and then library(XML).

Sources of XML files

If you need XML files to play with, here are some suggestions:

Level 1: XML files that play nice

A tutorial on using the package to grab an XML file can be found on R-Bloggers here

This will work if the XML file is nicely formatted. If not...

Level 2: XML files that don't play nice - converting to lists or using XPath

These solutions come from Stack Overflow