csb_filter returns observations that match any combination of the predefined categories that are created

csb_filter(.data, var, category)

Arguments

.data

A tibble or data frame

var

name of the column containing original problem code data

category

a vector with the unquoted name(s) of the category(s) for the function to return. You can also explicitly state quoted problemcode(s). Valid categories are: admin, animal, construction, debris, degrade, disturbance, event, health, landscape, law, maintenance, nature, road, sewer, traffic, vacant, and waste. If categories are listed, each should be preceded by 'cat_'.

Value

csb_filter returns data with an additional variable for an intelligible category for CSB requests.

Examples

csb_filter(january_2018, var = problemcode, category = cat_vacant)
#> # A tibble: 98 x 17 #> requestid datetimeinit probaddress probaddtype callertype neighborhood #> <dbl> <dttm> <chr> <chr> <chr> <dbl> #> 1 1049329 2018-01-02 08:20:46 4826 COTE … B PHONE 55 #> 2 1049336 2018-01-02 08:33:57 5700 WINON… B PHONE 7 #> 3 1049408 2018-01-02 10:33:44 4020 N FLO… A WEB 65 #> 4 1049432 2018-01-02 11:04:11 1330 GOODF… B PHONE 78 #> 5 1049461 2018-01-02 12:21:47 3907 KENNE… A WEB 56 #> 6 1049474 2018-01-02 12:54:16 4268 SAN F… B PHONE 68 #> 7 1049487 2018-01-02 13:14:27 3838 IOWA … B PHONE 16 #> 8 1049499 2018-01-02 13:41:04 1482 ROWAN… B PHONE 78 #> 9 1049527 2018-01-02 14:35:24 5319 SHAW … B PHONE 12 #> 10 1049552 2018-01-02 15:32:05 4623 NEWBE… A WEB 54 #> # … with 88 more rows, and 11 more variables: ward <dbl>, problemcode <chr>, #> # description <chr>, submitto <chr>, status <chr>, dateinvtdone <dttm>, #> # datetimeclosed <dttm>, prjcompletedate <dttm>, datecancelled <dttm>, #> # srx <dbl>, sry <dbl>
csb_filter(january_2018, var = problemcode, category = c(cat_waste, cat_debris))
#> # A tibble: 521 x 17 #> requestid datetimeinit probaddress probaddtype callertype neighborhood #> <dbl> <dttm> <chr> <chr> <chr> <dbl> #> 1 1049269 2018-01-01 10:12:26 6441 LLOYD… A WEB 42 #> 2 1049280 2018-01-01 16:41:22 3523 LOUIS… A WEB 19 #> 3 1049287 2018-01-01 20:56:17 4522 S COM… A WEB 17 #> 4 1049317 2018-01-02 08:06:14 929 BUENA … B PHONE 45 #> 5 1049328 2018-01-02 08:20:30 6311 WADE … A WEB 42 #> 6 1049329 2018-01-02 08:20:46 4826 COTE … B PHONE 55 #> 7 1049354 2018-01-02 08:59:40 2921 PARK … B PHONE 31 #> 8 1049361 2018-01-02 09:12:35 3680 MCREE… B TWITTER 29 #> 9 1049362 2018-01-02 09:14:33 3680 MCREE… B TWITTER 29 #> 10 1049366 2018-01-02 09:20:09 4882 LEE A… B PHONE 69 #> # … with 511 more rows, and 11 more variables: ward <dbl>, problemcode <chr>, #> # description <chr>, submitto <chr>, status <chr>, dateinvtdone <dttm>, #> # datetimeclosed <dttm>, prjcompletedate <dttm>, datecancelled <dttm>, #> # srx <dbl>, sry <dbl>
csb_filter(january_2018, var = problemcode, category = "WTR-COMING-UP")
#> # A tibble: 89 x 17 #> 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 1049275 2018-01-01 13:51:52 83 WILLMOR… A NA NA #> 4 1049277 2018-01-01 14:54:25 4234 BECK … A NA 15 #> 5 1049292 2018-01-01 22:36:52 4141 LOUGH… A WEB 4 #> 6 1049295 2018-01-01 23:18:39 CAROLINE S… B WEB 31 #> 7 1049301 2018-01-02 07:20:26 6200 THOLO… B WEB 9 #> 8 1049335 2018-01-02 08:33:50 S 18TH ST … B WEB 36 #> 9 1049335 2018-01-02 08:33:50 S 18TH ST … B TWITTER 36 #> 10 1049335 2018-01-02 08:33:50 S 18TH ST … B TWITTER 36 #> # … with 79 more rows, and 11 more variables: ward <dbl>, problemcode <chr>, #> # description <chr>, submitto <chr>, status <chr>, dateinvtdone <dttm>, #> # datetimeclosed <dttm>, prjcompletedate <dttm>, datecancelled <dttm>, #> # srx <dbl>, sry <dbl>