csb_date_parse
is used to parse out dates into
day, month, and year elements.
csb_date_parse(.data, var, day, month, year, drop = FALSE)
.data | A tibble or data frame |
---|---|
var | name of column containing date data |
day | Optional; returns a named column with parsed day |
month | Optional; returns a named column with parsed month |
year | Optional; returns a named column with parsed year |
drop | A logical scalar; if |
Returns a tibble with new columns containing parsed date information
csb_date_parse(january_2018, datetimeinit, dayInit)#> # 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>, dayInit <int>csb_date_parse(january_2018, datetimeinit, dayInit, monthInit)#> # A tibble: 1,554 x 19 #> 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 13 more variables: ward <dbl>, problemcode <chr>, #> # description <chr>, submitto <chr>, status <chr>, dateinvtdone <dttm>, #> # datetimeclosed <dttm>, prjcompletedate <dttm>, datecancelled <dttm>, #> # srx <dbl>, sry <dbl>, dayInit <int>, monthInit <dbl>csb_date_parse(january_2018, datetimeinit, month = monthInit)#> # 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>, monthInit <dbl>csb_date_parse(january_2018, datetimeinit, month = monthInit, year = yearInit)#> # A tibble: 1,554 x 19 #> 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 13 more variables: ward <dbl>, problemcode <chr>, #> # description <chr>, submitto <chr>, status <chr>, dateinvtdone <dttm>, #> # datetimeclosed <dttm>, prjcompletedate <dttm>, datecancelled <dttm>, #> # srx <dbl>, sry <dbl>, monthInit <dbl>, yearInit <dbl>csb_date_parse(january_2018, datetimeinit, dayInit, monthInit, yearInit, drop = TRUE)#> # A tibble: 1,554 x 19 #> requestid probaddress probaddtype callertype neighborhood ward problemcode #> <dbl> <chr> <chr> <chr> <dbl> <dbl> <chr> #> 1 1049265 75 WILLMOR… A WEB 8 16 WTR-COMING… #> 2 1049265 75 WILLMOR… A WEB 8 16 WTR-COMING… #> 3 1049266 6739 VERMO… A WEB 1 11 NOWATER #> 4 1049267 5444 ITASK… A WEB 7 16 NOWATER #> 5 1049268 CASS AVE &… B PHONE 60 5 Signal Stu… #> 6 1049269 6441 LLOYD… A WEB 42 24 Containr d… #> 7 1049270 3100 WINNE… B PHONE 19 20 Snow/Ice -… #> 8 1049271 S GRAND AV… B PHONE 25 8 Snow/Ice -… #> 9 1049272 SIDNEY ST … B WEB 25 6 FH-MAINTEN… #> 10 1049273 5400 N BRO… B PHONE 79 2 Snow/Ice -… #> # … with 1,544 more rows, and 12 more variables: description <chr>, #> # submitto <chr>, status <chr>, dateinvtdone <dttm>, datetimeclosed <dttm>, #> # prjcompletedate <dttm>, datecancelled <dttm>, srx <dbl>, sry <dbl>, #> # dayInit <int>, monthInit <dbl>, yearInit <dbl>