To make your example reproducible, I had to create a dummy data.frame
z:
z <- structure(list(date = structure(c(14598, 14600), class =
"Date"),
fraction_viewing_feature = c(0.3, 0.5)), .Names = c("date",
"fraction_viewing_feature"), row.names = c(NA, -2L), class =
"data.frame")
Then either of the following will work:
ggplot(z,aes(x=date,y=fraction_viewing_feature)) + geom_line() +
scale_x_date() + geom_vline(aes(xintercept=as.Date("2009-12-21")),
color="red")
or
ggplot(z,aes(x=date,y=fraction_viewing_feature)) + geom_line() +
scale_x_date() + geom_vline(xintercept=unclass(as.Date("2009-12-21")),
color="red")
The unclass(as.Date(...)) construct is what you asked for a way to
derive the number of days since the epoch.
--Brian Diggs
A slightly better (i.e. more general approach) is as.numeric(as.Date(...))
Hadley