I want to plot a line graph showing no. of articles published over time. X axis should be date, Y axis should be no. of articles published that day. My dataframe looks something like
Article_title Date_Published
Title 1 2016-08-11
Title 2 2016-08-11
Title 3 2016-08-11
Title 4 2016-08-12
Title 5 2016-08-13
Title 6 2016-08-13
Title 7 2016-08-14
Title 8 2016-08-14
Title 9 2016-08-14
Title 10 2016-08-14
So what I'm looking for is to count the data by date so I get a graph which looks like
Not bothered with the actual formatting, I want to know how to plot the aes() section in ggplot().
Thanks in advance.
ggplot(dat, aes(x=Date_Published)) + stat_count(geom='line', aes(y=..count..))
, assuming your data frame is calleddat
...count..
is an internal variable thatstat_count
creates to store the count values. – eipi10+geom_smooth()
on the end results in an error (missing y aesthetic). Is there a better way to add geom_smooth? Thanks. – jceg316