Wednesday, 4 March 2015

R importing XML missing empty columns



I'm attempting to import a XML file of row column data (from a data recorder) using R. I have tried using the XML package and the following code...



# XML package
require(XML)

# Read the data
InputFl<-"MyFile.xlm"
InptDt<-xmlToDataFrame(InptFl)
names(InptDt)


This imports (most of) the data successfully to a data.frame but excludes columns (which have a header) but where all values are null (I can see these columns when I import to file to Access using that XML importer).


I experimented with...



InptDt<-xmlTreeParse(InptDt, ignoreBlanks=TRUE)
str(InptDt)


This approach seem to parse all fields in parsed object (I can seem them in the file structure) but I'm not sure how to parse this object as a data.frame?


No comments:

Post a Comment