I am using R to create a surface chart out of data from a csv file with the following schema:
Date,Event Score,Location
2014-01-01,10,Louisville
2014-02-03,13,Atlanta
2014-03-10,99,Boulder
Just to clearly, that is to say, in Louisville there was an event score of 10 on January 1st, 2014; February 2nd, 2014 in Atlanta saw an event score of 13; and finally in Boulder on March 10th, 2014, there was an event score of 99.
I have about 100,000+ records like this and would like to generate a surface chart with x axis being the city name, the y axis being the date, and the z axis simply being normal numerical data (the "event score").
I pull in the data using the following via this site:
HM <- read.csv("/path/to/data.csv")
And convert the date column as follows via this post:
HM$Date <- as.Date(HM$Date, "$Y-%m-%d")
I have attempted a couple times with wireframe from lattice, but to no avail. I have a feeling it is related to my understanding of how R manipulates data in variables. I even tried just mapping the date and the score using R_Users technique, alas again with no results. Below is how I mocked up his code:
HM <- read.csv("/path/to/data.csv")
HM$Date <- as.Date(HM$Date, "$Y-%m-%d")
plot(Event.Score ~ Date, HM, xaxt = "n",type = "1")
axis(1, HM$Date, format(HM$Date, "%b %d"), cex.axis = .7)
After running the plot command, I receive the following error:
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
What I am looking for is either a direction to some clearer documentation on how to chart an axis as a list of names/dates and any advice, tricks, or examples of how to actually generate this.
Thank you much, and feel free to follow up with questions.