tc_recode_vehicle_type: Recode vehicle type

Description Usage Arguments See Also Examples

View source: R/tc_recode.R

Description

Recode vehicle type

Usage

1
2
3
4
5
6
7
tc_recode_vehicle_type(
  x,
  pattern = c(`Taxi*.+` = "Taxi", `Van*.+` = "Van", `Pedal cycle` = "Bicycle",
    `(M|m)otorcycle*.+|Elec*.+` = "Motorcycle",
    `Data*.+|Other*.+|Agri*.+|Ridden*.+|Mobility*.+|Tram*.+` = "Other", `Bus*.+` = "Bus",
    `Minibus*.+` = "Other", `Goods*.+` = "HGV")
)

Arguments

x

Character string to recode

pattern

A named character vector with values representing new values. Has the form c("Car long name" = "Car", "Taxi/Private hire car" = "Taxi"). Car long name will be converted into Car in this case.

See Also

tc_recode

Examples

1
2
3
4
5
6
7
8
9
(x = stats19::vehicles_sample$vehicle_type)
tc_recode_vehicle_type(x)
## Not run: 
v = stats19::get_stats19(2018, "vehicles")
v$vehicle_type_simple = tc_recode_vehicle_type(v$vehicle_type)
table(v$vehicle_type)
table(v$vehicle_type_simple)

## End(Not run)

saferactive/traffiCalmr documentation built on Nov. 18, 2021, 5:06 a.m.