Skip to contents

The mirror of morie_tps_add_hood_158_from_140(). For 158-hoods that did not exist in the 140-scheme (the newly-split children like Etobicoke City Centre / Islington from 14-Islington-City- Centre-West) the result is the historical parent 140-hood.

Usage

morie_tps_add_hood_140_from_158(
  df,
  col_in = NULL,
  col_out = "HOOD_140_equiv",
  crosswalk = NULL
)

Arguments

df

A TPS crime data.frame.

col_in

Name of the input HOOD_158 column.

col_out

Name of the new column. Default "HOOD_140_equiv".

crosswalk

Optional pre-loaded crosswalk; defaults to morie_to_hood_crosswalk().

Value

df with the equivalent-code column appended.

Examples

cw <- morie_to_hood_crosswalk()
df <- data.frame(HOOD_158 = utils::head(cw$HOOD_158, 5))
res <- try(morie_tps_add_hood_140_from_158(df))
#> Error : no HOOD_158 column found in df
if (!inherits(res, "try-error")) head(res)