So, looking at the ggplot2 examples online, it seems that all the data used are structured as different observations of data (as rows) and consistent attributes among those for columns.
e.g.
head(mtcars)
mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
Now, I'm trying to graph data that I personally organized structured as dates for rows, and presidential candidates for columns. The observations being their overall percentage of votes in polls.
The data looks like this
load(url("http://www.clutchmemes.com/Random/GOPArray.RData"))
require(plyr)
averagedGOPPoll <- as.data.frame(aaply(allGOP, 1:2, mean, na.rm=TRUE))
averagedGOPPoll <- cbind(dates=as.Date(rownames(averagedGOPPoll)), veragedGOPPoll)
head(averagedGOPPoll)
dates Trump Carson Rubio Cruz Bush Rand.Paul Christie Fiorina
2015-01-01 2015-01-01 NaN NaN NaN NaN NaN NaN NaN NaN
2015-01-02 2015-01-02 NaN NaN NaN NaN NaN NaN NaN NaN
2015-01-03 2015-01-03 NaN NaN NaN NaN NaN NaN NaN NaN
2015-01-04 2015-01-04 NaN NaN NaN NaN NaN NaN NaN NaN
2015-01-05 2015-01-05 NaN NaN NaN NaN NaN NaN NaN NaN
2015-01-06 2015-01-06 NaN NaN NaN NaN NaN NaN NaN NaN
How could I go about graphing this in a linear fashion with the dates on the y-axis, and different line for each candidate, and the total percentage votes of the x-axis.
Something like this: (Taken from Huffington Post) My question is unique because I need a very robust way to organize such structured data, because I will be combining this with data from polls comparing Democratic Polls, as well as Google Trends data. Since boiling it down to where I have it is relatively easy, I needed a systematic way to get this down a "melted" position. So yes, my question is unique, and the answers were also uniquely fitting to my question. Not sure why this is repetative.