I've been trying to add a trend line for my ggplot (regarding to sent data of email campaign & corresponding open rate).
I had first converted the x-axes into time series data, while y-axes is the open rate in %, then I plotted the ggplot as normal. Below is my codes:
x= strptime(service_equity$`Send Date`, '%d/%m/%Y')
y = service_equity$`Open Rate`
ggplot(service_equity, aes(x,y)) + geom_point() + geom_smooth(method= "lm") ggtitle("Trend in Open Rate")
The data used in the plot:
> x[1] "2015-02-24 GMT" "2014-09-16 BST" "2015-10-26 GMT" "2016-10-27 BST" "2017-01-19 GMT" "2015-06-25 BST" "2017-03-14 GMT" "2017-04-27 BST"
> y[1] "23.15%" "26.62%" "26.93%" "22.94%" "25.26%" "23.85%" "19.59%" "17.14%" "27.68%" "26.56%" "24.14%" "26.36%" "22.32%" "34.63%" "34.60%"
The scatter plot was successfully plotted, but the trend line isn't there, and there are no error message or notification regarding to the "geom_smooth" function.
Please help!