Displaying 1 result from an estimated 1 matches for "populationsize".
2009 Jul 14
1
(simple) xml into data.frame and reverse
...ng fancy (no child nodes or anything, at least as far
as I can see.
### data.frame
data<- as.data.frame(cbind(c( 0 , 1 ),c( 500 , 300),c(200, 400)))
names(data)<-c("age","0","1")
### converts data.frame into XML
xml <- xmlTree()
xml$addTag("populationsize", close=FALSE)
for (i in 1:nrow(data)) {
xml$addTag("size", close=FALSE)
for (j in names(data)) {
xml$addTag(j, data[i, j])
}
xml$closeTag()
}
xml$closeTag()
# view the result
cat(saveXML(xml))
I put below also an example of how my data looks like.
Thanks fo...