Package 'roadcrashVIC'

Title: Explore Victorian Road Crashes
Description: Provides cleaned Victorian road crash data (casualty crashes, 2012 to 2025), local government area boundaries and resident population, with functions to filter crashes by date, summarise them by any variable and calculate rates per 100,000 residents. Includes a Shiny app for exploring how road trauma has changed across Victoria, when and where crashes happen, and which road users are most affected, state-wide or in selected local areas (LGAs).
Authors: Eduardo Vitale [aut, cre, cph]
Maintainer: Eduardo Vitale <[email protected]>
License: AGPL (>= 3)
Version: 0.2.0
Built: 2026-11-17 17:11:04 UTC
Source: https://github.com/EduVit/roadcrashVIC

Help Index


Crash and casualty rates per 100,000 residents

Description

Adds the population and the number of crashes and casualties per 100,000 residents per year to summarise_crashes(). Groups that cover several years use the population summed over those years.

Usage

crash_rates(data, population, by = "year")

Arguments

data

A data frame of crashes, such as vic_crashes, optionally filtered with filter_crashes().

population

A data frame of population by year and lga_name, such as vic_population.

by

"year", "lga_name" or c("year", "lga_name").

Value

The columns of summarise_crashes(), plus:

population

Residents, summed over the years in the group.

crashes_per_100k

Crashes per 100,000 residents per year.

fatalities_per_100k

People killed per 100,000 residents per year.

serious_injuries_per_100k

People seriously injured per 100,000 residents per year.

other_injuries_per_100k

People with other injuries per 100,000 residents per year.

ksi_per_100k

People killed or seriously injured per 100,000 residents per year.

Examples

# Victoria, year by year
crash_rates(vic_crashes, vic_population, by = "year")

# Average annual rate in each LGA over 2021 to 2025
vic_crashes |>
  filter_crashes(start_date = "2021-01-01", end_date = "2025-12-31") |>
  crash_rates(vic_population, by = "lga_name")

Filter crashes to a date range

Description

Keep only the crashes that happened between two dates (both included).

Usage

filter_crashes(
  data,
  start_date = min(data$accident_date),
  end_date = max(data$accident_date)
)

Arguments

data

A data frame of crashes with an accident_date column, such as vic_crashes.

start_date, end_date

First and last day to keep, as dates or "YYYY-MM-DD" strings. Default to the first and last date in data.

Value

The rows of data between start_date and end_date, with the same columns.

Examples

# Crashes in the 2024-25 financial year
fy <- filter_crashes(vic_crashes, start_date = "2024-07-01", end_date = "2025-06-30")
nrow(fy)

# Only a start date: everything from 2020 onwards
nrow(filter_crashes(vic_crashes, start_date = "2020-01-01"))

Launch the Victorian road crash app

Description

Opens the Shiny app included in the package, in the browser or in the RStudio/Positron viewer.

Usage

run_app()

Value

No return value; called for its side effect of launching the app.

Examples

if (interactive()) run_app()

Summarise crashes and casualties by one or more variables

Description

Counts crashes and people killed and injured in each group, and the number of casualties per 1,000 crashes. KSI is people killed or seriously injured.

Usage

summarise_crashes(data, by)

Arguments

data

A data frame of crashes, such as vic_crashes, optionally filtered with filter_crashes().

by

Character vector of columns to group by, for example "hour" or c("day_of_week", "hour").

Value

A tibble with one row per group, sorted by the grouping columns, with columns:

crashes

Number of crashes.

fatalities

People killed.

serious_injuries

People seriously injured.

other_injuries

People with other injuries.

ksi

People killed or seriously injured.

fatalities_per_1000_crashes

People killed per 1,000 crashes.

serious_injuries_per_1000_crashes

People seriously injured per 1,000 crashes.

other_injuries_per_1000_crashes

People with other injuries per 1,000 crashes.

ksi_per_1000_crashes

People killed or seriously injured per 1,000 crashes.

Examples

summarise_crashes(vic_crashes, by = "hour")

vic_crashes |>
  filter_crashes(start_date = "2022-01-01", end_date = "2024-12-31") |>
  summarise_crashes(by = c("day_of_week", "hour"))

Summarise crashes involving vulnerable road users

Description

Applies summarise_crashes() to all crashes, and to the crashes involving a pedestrian, a cyclist or a motorcyclist.

Usage

summarise_vulnerable(data)

Arguments

data

A data frame of crashes, such as vic_crashes, optionally filtered with filter_crashes().

Value

A tibble with four rows (⁠All crashes⁠, Pedestrian, Cyclist, Motorcyclist): a road_user column, then the columns of summarise_crashes().

Examples

summarise_vulnerable(vic_crashes)

Victorian road crashes resulting in casualties, 2012 to 2025

Description

One row per road crash in Victoria in which at least one person was injured or killed, from 1 January 2012 to 31 December 2025, as recorded by Victoria Police.

Usage

vic_crashes

Format

A tibble with 202,065 rows and 51 columns:

accident_no

(character) Unique crash identifier.

accident_date

(Date) Date of the crash.

year

(integer) Year of the crash.

month

(factor) Month of the crash, Jan to Dec.

day_of_week

(factor) Day of the week, Monday to Sunday.

hour

(integer) Hour of the day, 0 to 23 (17 means 5:00pm to 5:59pm).

accident_type

(character) Type of crash, for example ⁠Collision with vehicle⁠ or ⁠Struck Pedestrian⁠.

dca_code_description

(character) Detailed crash type (Definitions for Classifying Accidents).

light_condition

(character) Light at the time of the crash, for example Day or ⁠Dark No street lights⁠.

police_attend

(character) Whether police attended the scene (Yes or No).

road_geometry

(character) Road layout, for example ⁠T intersection⁠ or ⁠Not at intersection⁠.

severity

(factor) Severity of the crash: ⁠Fatal accident⁠, ⁠Serious injury accident⁠ or ⁠Other injury accident⁠.

speed_zone

(ordered factor) Speed limit, ⁠30 km/h⁠ to ⁠110 km/h⁠, then ⁠Off road⁠ and Other.

run_offroad

(character) Whether the vehicle ran off the road (Yes or No).

road_full_name

(character) Road name and type, for example ⁠Alfred Street⁠.

lga_name

(character) Local government area (LGA), spelled as in vic_lga.

dtp_region

(character) Department of Transport and Planning region.

latitude

(numeric) Latitude of the crash.

longitude

(numeric) Longitude of the crash.

total_persons

(numeric) People involved.

inj_or_fatal

(numeric) People killed or injured.

fatality

(numeric) People killed.

seriousinjury

(numeric) People seriously injured.

otherinjury

(numeric) People with other injuries.

noninjured

(numeric) People not injured.

males

(numeric) Males involved.

females

(numeric) Females involved.

bicyclist

(numeric) Cyclists involved.

passenger

(numeric) Passengers involved.

driver

(numeric) Drivers involved.

pedestrian

(numeric) Pedestrians involved.

pillion

(numeric) Pillion passengers involved.

motorcyclist

(numeric) Motorcyclists involved.

unknown

(numeric) Road users of unknown type involved.

ped_cyclist_5_12

(numeric) Pedestrians and cyclists aged 5 to 12 involved.

ped_cyclist_13_18

(numeric) Pedestrians and cyclists aged 13 to 18 involved.

old_ped_65_and_over

(numeric) Pedestrians aged 65 and over involved.

old_driver_75_and_over

(numeric) Drivers aged 75 and over involved.

young_driver_18_25

(numeric) Drivers aged 18 to 25 involved.

no_of_vehicles

(numeric) Vehicles involved, including bicycles.

heavyvehicle

(numeric) Heavy vehicles involved.

passengervehicle

(numeric) Passenger vehicles involved.

motorcycle

(numeric) Motorcycles involved.

pt_vehicle

(numeric) Public transport vehicles involved (tram, bus or train).

deg_urban_name

(character) How urban the location is, for example MELB_URBAN or RURAL_VICTORIA.

rma

(character) Road classification, for example Freeway or ⁠Local Road⁠.

divided

(character) Whether the road is divided (Divided or Undivided).

stat_div_name

(character) Statistical division (Metro or Country).

involves_pedestrian

(logical) At least one pedestrian involved.

involves_cyclist

(logical) At least one cyclist involved.

involves_motorcyclist

(logical) At least one motorcyclist or pillion passenger involved.

Source

Victorian Government (Department of Transport and Planning), Victorian road crash data, https://discover.data.vic.gov.au/dataset/victoria-road-crash-data, licensed under CC BY 4.0. Data last updated 13 October 2026; retrieved 25 October 2026.

Changes made: kept casualty crashes up to 31 December 2025; cleaned column names; added year, month, hour, road_full_name and the ⁠involves_*⁠ columns; converted categories to factors; set Unk., Unknown and ⁠Not known⁠ to NA; matched LGA names to vic_lga; removed ACCIDENT_TIME, VICGRID_X, VICGRID_Y, ROAD_ROUTE_1, ROAD_NAME, ROAD_TYPE, DCA_CODE and SRNS.


Victorian local government area boundaries

Description

Simplified boundaries of the local government areas (LGAs) in Victoria, for mapping.

Usage

vic_lga

Format

An sf object (a tibble with a geometry column) with 80 rows and 4 columns:

lga_code

(character) ABS LGA code.

lga_name

(character) LGA name in capitals, for example MERRI-BEK.

unincorporated

(logical) TRUE for the unincorporated areas (alpine resorts and islands).

geometry

(sfc_MULTIPOLYGON) Boundary, in longitude and latitude (WGS 84).

Source

Department of Transport and Planning, State of Victoria, Vicmap Admin - Local Government Area (LGA) Polygon Aligned to Property (resource LGA_POLYGON, metadata ID cff349f9-3ef3-51bd-b5a9-ae650f6d6c24), published 16 October 2026, licensed under CC BY 4.0. Retrieved 25 October 2026. https://discover.data.vic.gov.au/dataset/vicmap-admin-local-government-area-lga-polygon-aligned-to-property.

Changes made: kept the ABS code and name; merged the unincorporated areas into one ⁠UNINCORPORATED VIC⁠ feature; added unincorporated; converted to WGS 84; simplified with a 100 m tolerance; sorted by name.


Estimated resident population of Victorian local government areas

Description

Estimated resident population of each Victorian local government area (LGA) at 30 June, 2012 to 2025.

Usage

vic_population

Format

A tibble with 1,120 rows and 4 columns:

lga_code

(character) ABS LGA code.

lga_name

(character) LGA name in capitals, spelled as in vic_lga and vic_crashes.

year

(integer) Year (population at 30 June).

population

(numeric) Estimated resident population.

Source

Australian Bureau of Statistics, Regional population, 2024-25 (Cat. no. 3218.0), dataset ERP_LGA2025, https://www.abs.gov.au/statistics/people/population/regional-population/2024-25, licensed under CC BY 4.0. Retrieved 25 October 2026. Changes made: kept Victorian LGAs for 2012 to 2025; renamed columns; LGA names in capitals without the "(Vic.)" suffix.