I got this data frame (tweets_platform) from Twitter data by TweetteR
id source created
7,71627E+17 iPhone 02/09/2016 08:34
7,71627E+17 iPhone 02/09/2016 08:34
7,71627E+17 Android 02/09/2016 08:34
7,71627E+17 Android 02/09/2016 08:34
7,71627E+17 iPhone 02/09/2016 08:34
7,71627E+17 iPhone 02/09/2016 08:34
And I'd like to get this line Chartin order to highlight in which part of the day the tweets occur
library(lubridate)
library(scales)
tweets_platform %>%
count(source, hour = hour(with_tz(created, "EST"))) %>%
mutate(percent = n / sum(n)) %>%
ggplot(aes(hour, percent, color = source)) +
geom_line() +
scale_y_continuous(labels = percent_format()) +
labs(x = "Hour of day (EST)",
y = "% of tweets",
color = "")
However when I run the code the console returns this error:
geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?
and it plots only the graph without the lines. How can I fix the problem?