csb_categorize provides general categories for the CSB data based on problem code. These were created based on a review of the call data in mid-2018.

csb_categorize(.data, var, newVar)

Arguments

.data

A tibble or data frame

var

Name of existing column containing problem codes

newVar

Name of output variable to be created with category string

Value

Returns a tibble with the string vector added as a new variable.

Examples

csb_categorize(january_2018, var = problemcode, newVar = Category)
#> # A tibble: 1,554 x 18 #> requestid datetimeinit probaddress probaddtype callertype neighborhood #> <dbl> <dttm> <chr> <chr> <chr> <dbl> #> 1 1049265 2018-01-01 00:48:30 75 WILLMOR… A WEB 8 #> 2 1049265 2018-01-01 00:48:30 75 WILLMOR… A WEB 8 #> 3 1049266 2018-01-01 05:29:06 6739 VERMO… A WEB 1 #> 4 1049267 2018-01-01 08:53:07 5444 ITASK… A WEB 7 #> 5 1049268 2018-01-01 09:13:22 CASS AVE &… B PHONE 60 #> 6 1049269 2018-01-01 10:12:26 6441 LLOYD… A WEB 42 #> 7 1049270 2018-01-01 10:52:32 3100 WINNE… B PHONE 19 #> 8 1049271 2018-01-01 10:54:43 S GRAND AV… B PHONE 25 #> 9 1049272 2018-01-01 11:07:02 SIDNEY ST … B WEB 25 #> 10 1049273 2018-01-01 12:05:40 5400 N BRO… B PHONE 79 #> # … with 1,544 more rows, and 12 more variables: ward <dbl>, problemcode <chr>, #> # description <chr>, submitto <chr>, status <chr>, dateinvtdone <dttm>, #> # datetimeclosed <dttm>, prjcompletedate <dttm>, datecancelled <dttm>, #> # srx <dbl>, sry <dbl>, Category <chr>