Read internal data

# devtools::load_all()
data("database", package = "clientapp")
data("fra_sf", package = "clientapp")

Join tables

Join client and tickets tables

ticket_complete <- database$tickets %>% 
  left_join(database$clients, by = "num_client")

Explore data

ticket_complete %>% 
  mutate(state_reduce = case_when(
    grepl("Attente", state) ~ "Awaiting",
    state == "Terminé" ~ "Done",
    TRUE ~ "Proceeding"  
    )) %>% 
  count(state_reduce)
#> # A tibble: 2 × 2
#>   state_reduce     n
#>   <chr>        <int>
#> 1 Awaiting       576
#> 2 Proceeding     924