Traffic by Day of the Week

weekly_visits <- visits %>% 
  mutate(
    dt = floor_date(visitStartTime, unit = "month")) %>%
  mutate(
    day = wday(visitStartTime, 
    label = TRUE)) %>% 
  group_by(dt, day, year = year(visitStartTime), month=month(visitStartTime)) %>% 
  summarise(
    number_visits_per_week = n(),
    .groups = "drop")

ggplotly(weekly_visits %>%  ggplot(aes(y= number_visits_per_week , x = dt, colour = factor(day)))+
           geom_point()+
           geom_line() +
           labs(
             title = "Which day is the most popular for the website",
             x = "year",
             y = "Number of visits",
             color = "Day of the week"))