Re: [R] XML to data frame or list

From: Barry Rowlingson <>
Date: Sat 12 Mar 2005 - 02:06:18 EST

Gabor Grothendieck wrote:

> You could check out the ctv package that was recently announced.
> It uses XML so its source would provide an example.
> If its a one-time operation, Excel reads XML and you could then
> use one of the many Excel to R possibilities.

  For an xml file like this:

<?xml version="1.0"?>

its a one-liner with the XML package (library(XML)):

xmlReadSimple <-

   as.list(xmlSApply(xmlRoot(xmlTreeParse(xmlFile)),xmlValue)) }

add an lapply(...,as.numeric) for conversion to numbers.


Baz mailing list PLEASE do read the posting guide! Received on Mon Mar 14 10:34:12 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:47 EST