I want a histogram of counts for some data I have. The data is not equally spaced in time (i.e there may be some days missing). I can create a histogram using
ym_plot <- ggplot(data = df %>% mutate(timestamp = as.POSIXct(timestamp)), aes(timestamp)) +
geom_histogram(aes(fill = ..count..))
print(ym_plot)
However, there are 8 bins between each year, so the bins do not map to months. Is there an easy way to set the bins to one month? If the data started at the beginning of one year I would do 12*number_of_months
.
Edit:
Here is a sample
[1] "2013-07-15 22:12:43 EST"
[1] "2013-05-04 21:30:06 EST"
[1] "2017-01-02 02:28:02 EST"
[1] "2013-02-28 08:06:09 EST"
[1] "2011-11-10 13:57:16 EST"
[1] "2015-11-12 21:05:37 EST"
[1] "2011-10-31 13:02:21 EST"
[1] "2015-01-18 12:22:45 EST"
[1] "2013-02-04 11:57:41 EST"
[1] "2011-10-16 21:54:27 EST"
[1] "2013-06-19 23:11:45 EST"
[1] "2015-08-16 19:26:29 EST"
[1] "2016-11-09 21:48:20 EST"
[1] "2011-06-13 13:30:19 EST"
[1] "2012-05-08 02:50:42 EST"
[1] "2014-10-15 23:27:28 EST"
[1] "2012-03-11 00:56:05 EST"
[1] "2014-07-16 17:32:34 EST"
[1] "2011-08-08 19:01:39 EST"
[1] "2014-08-31 13:41:49 EST"
[1] "2017-03-09 23:23:45 EST"
[1] "2013-02-16 13:27:49 EST"
[1] "2012-08-22 23:58:33 EST"
[1] "2012-04-20 11:06:32 EST"
[1] "2016-01-22 20:50:30 EST"