This is a follow up question as hadley pointed out unless I fix the problem with the time stamps the graphs I produce would be incorrect. With this in mind I am working towards fixing the issues I am having with the code. So far I have from my earlier questions that have been answered stopped using the attach() function in favour of using dataSet.df$variableName I am having problems drawing the graph from the strptime time stamps. I will attach all the code I am using and the XML file from which the data set is parsed (This was also answered in an earlier question) from.
<?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>
The R code I have currently is as follows:
library(ggplot2)
library (XML)
test.df <- xmlToDataFrame("c:/Users/user/Desktop/shares.xml")
test.df
timeStampParsed <- strptime(as.character(test.df$timeStamp), "%H:%M:%OS")
test.df$Price <- as.numeric(as.character(test.df$Price))
summary (test.df)
mean(test.df$Price)
sd (test.df$Price)
mean(timeStampParsed)
par(mfrow=c(1,2))
plot(timeStampParsed, test.df$Price)
qplot(timeStampParsed,Price,data=test.df,geom=c("point","line"),
scale_y_continuous(limits = c(10,26)))
The plot command produces a graph but it is not very pleasant looking. the qplot command returns the following error message:
Error in sprintf(gettext(fmt, domain = domain), ...) :
invalid type of argument[1]: 'symbol'
In the interest in getting this right (and cutting down on the questions being asked) is there a tutorial / website that I can use? Once again thanks very much for your help.