im a newbie in R.
I've got timestamps in a list in this style:
[1] "2011-10-04 17:23:28 CEST" "2011-10-04 17:26:13 CEST" "2011-10-05 16:17:34 CEST" "2011-10-07 09:59:37 CEST"
Now I want to plot a graph which shows me how many events occur in january, february and so on.
Every timestamp represents one event and there may be months without an event (that should be shown as 0)
I would put the vector of times into a column of a data.frame. The example data below has a thousand timestamps with a random time between the current time and two year from now.
Next step is to create a new column that identifies which month and year the timestamp is in:
Now we can count the timestamps per month for each year using
count
from theplyr
package.And create the histogram with ggplot2:
See this SO post for an example of how the resulting plot looks like:
How to create histogram in R with CSV time data?