Monthly visits

monthly_visits <- visits %>%
  mutate(
    dt = as.Date(visitStartTime),
    year = year(dt),
    month = month(dt) ) %>%
  group_by(year, month) %>%
  summarise(
    number_of_visits_per_month = n(),
    .groups = "drop")

ggplotly(monthly_visits %>% ggplot(aes(x = month, y = number_of_visits_per_month, colour = factor(year))) +
    geom_point() +
    geom_line() +
    scale_x_continuous( breaks = 1:12, labels = month.abb) +
    labs(
      title = "Monthly visits",
      x = "Month",
      y = "Number of visits",
      color = "Year"))