I got help parsing the following XML file on this site:
<?xml version = "1.0"?>
<Company >
<shareprice>
<timeStamp> 12:00:00.01</timeStamp>
<Price> 25.02</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:00.02</timeStamp>
<Price> 15</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:00.025</timeStamp>
<Price> 15.02</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:00.031</timeStamp>
<Price> 18.25</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:00.039</timeStamp>
<Price> 18.54</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:00.050</timeStamp>
<Price> 16.52</Price>
</shareprice>
<shareprice>
<timeStamp> 12:00:01.01</timeStamp>
<Price> 17.50</Price>
</shareprice>
</Company>
I am using the following code in R to try and plot the data to get the share price on the Y axis and the timestamp on the x axis:
library (XML)
test.df <- xmlToDataFrame("c:/Users/user/Desktop/shares.xml")
test.df
attach(test.df)
mean(as.numeric(Price))
sd (as.numeric(Price))
plot(timeStamp,as.numeric(Price))
However the resulting plot is not what I expect. It returns the Time stamps on the x axis but the y axis is numbered from 1 - 7. Is there something I should be doing to alter the data set either in R or the XML file itself?