From reading, then having tried several previous examples in StackOverflow related to reading an XML file in R, it seems that due to the βunevenβ nature of the next file, I cannot use XPath-related methods.
https://www.dropbox.com/s/jz8sj2fifuobkva/Data.xml?oref=e&n=305307914
Therefore, it seems to me that I need to use a combination of xmlToList () and ldply () to read data from the next file.
In particular, for all 20 events in the file (i.e. event.1, event.2, ... event.20), I want to get the following variables (structured as)
$movements$movement$clips$clip$data$event$begin (vector)$movements$movement$clips$clip$data$event$end (vector)$movements$movement$clips$clip$data$event$max$cells (data frame)- As indicated above, but
$rollover$data$quant$cellswhere in the event there are several samples (n data frames)
Based on other StackOverflow code examples (using R v3.1.2) I tried to read the data "start" as follows: -
library(XML)
library(plyr)
datfile <- "D:/Data.xml"
xmlfile <- xmlTreeParse(datfile,useInternal = TRUE)
sampledata <- xmlToList(xmlfile)
startdata <- ldply(sampledata$movements$movement$clips$clip$data$event$begin)
When I do this, I get the first variable (0.240) in the .1 event. Now I got to the point of being stuck and exhausted my research on how to do this.
source
share