Description Usage Arguments Examples
Create 'who-hit-who' visualisations
1 2 3 4 5 6 |
crash_summary |
crashes dataset with vehicles and casuatlties variables |
casualty_type |
The casualty types to plot |
family |
font family |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | crash_summary = tc_join_stats19_for_upset(crashes_wf, casualties_wf, vehicles_wf)
names(crash_summary)
summary(crash_summary)
tc_upset(crash_summary)
tc_upset(crash_summary, casualty_type = c("Car", "Pedestrian", "Bicycle"))
# create plot with 'Other' category
table(casualties_wf$casualty_type)
casualties_wf2 = dplyr::mutate(
casualties_wf,
casualty_type_simple = dplyr::case_when(
casualty_type == "Car occupant" ~ "Car",
casualty_type == "Pedestrian" ~ "Pedestrian",
casualty_type == "Cyclist" ~ "Cyclist",
TRUE ~ "Other"
)
)
table(casualties_wf2$casualty_type_simple)
table(vehicles_wf$vehicle_type)
vehicles_wf2 = dplyr::mutate(
vehicles_wf,
vehicle_type_simple = dplyr::case_when(
vehicle_type == "Car" ~ "Car",
vehicle_type == "Bicycle" ~ "Pedal cycle",
TRUE ~ "Other"
)
)
crash_summary = tc_join_stats19_for_upset(crashes_wf, casualties_wf2, vehicles_wf2)
tc_upset(crash_summary, casualty_type = c("Car", "Pedestrian", "Bicycle", "Other"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.