I have downloaded a timeline from a twitter user and try to visualise the number of tweets over time. I'm doing it with rtweets ts_plot. Now I'm trying to add a vertical line in my graph. As far as I know ts_plot allows you to work with it as if it was a normal ggplot. Therefore, I tried ggplot2's geom_vline:
This is my code:
zanetti <- get_timeline("@zac1967", n=3200)
ts_plot(zanetti, "days") +
theme_bw() +
xlab("") +
ylab("# of tweets/day") +
geom_vline( aes(xintercept = "2019-03-21 00:00:00 UTC"))
However, I receive this error message:
no applicable method for 'rescale' applied to an object of class "character"
So i tried the same code but added as.numeric in the last line:
ts_plot(zanetti, "days") +
theme_bw() +
xlab("") +
ylab("# of tweets/day") +
geom_vline( aes(xintercept = as.numeric("2019-03-21 00:00:00 UTC")))
Which leads to following error message:
Warning messages:
1: In FUN(X[[i]], ...) : NAs introduced by coercion
2: Removed 53 rows containing missing values (geom_vline).
as.numeric
tryas.Date
– G5W