Recode maxspeed values in OSM

tc_recode_speeds_uk(
  x,
  allowed_values = c("20 mph", "30 mph", "40 mph", "50 mph", "60 mph", "70 mph"),
  pattern = c(national = "60 mph", `0$` = "0 mph")
)

Arguments

x

Character string to recode

allowed_values

Values that can be returned, other than NA

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.

Examples

x = c("30 mph", "10 mph", "60 mph", "25 mph", "30", "national")
tc_recode_speeds_uk(x)
#> [1] "30 mph" NA       "60 mph" NA       "30 mph" "60 mph"