I am trying to add a vertical line at a specific date on an axis of Dates. Based on this SO post it seems that I need to cast the Date as numeric, however that doesn't work for me. What am I doing wrong?
My error:
Error: ggplot2 doesn't know how to deal with data of class uneval
My code
library(lubridate)
trump_score<-NULL
trump_score$Date <-parse_date_time(c("2017-01-01","2017-01-24","2017-01-25"), orders="ymd")
trump_score$powerSentimentScore<-c(10,25,10)
denyTPP<-parse_date_time("2017-01-23", orders="ymd ")
require(ggplot2)
ggplot( aes(trump_score$Date))+
geom_line(aes(y=trump_score$powerSentimentScore),colour="green")+
geom_vline(aes(xintercept = as.POSIXct(as.Date(denyTPP))), linetype="dotted", color = "blue", size=1.5)