-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41552b2
commit 52ff396
Showing
25 changed files
with
401 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
^vignettes/articles$ | ||
^codecov\.yml$ | ||
^data-raw$ | ||
^man-roxygen$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.httr-oauth | ||
.DS_Store | ||
docs | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#' Apply 30-Day Aging Bins | ||
#' | ||
#' @param df `<data.frame>` or `<tibble>` with a required date column | ||
#' | ||
#' @param date column of `<date>`s | ||
#' | ||
#' @returns a [tibble][tibble::tibble-package] | ||
#' | ||
#' @examples | ||
#' binned <- bin_aging(load_ex(), dos) | ||
#' | ||
#' head(binned) | ||
#' | ||
#' binned |> | ||
#' dplyr::arrange(aging_bin) |> | ||
#' dplyr::summarise( | ||
#' n_claims = dplyr::n(), | ||
#' balance = sum(charges), | ||
#' .by = aging_bin) | ||
#' | ||
#' binned |> | ||
#' dplyr::arrange(aging_bin) |> | ||
#' dplyr::summarise( | ||
#' n_claims = dplyr::n(), | ||
#' balance = sum(charges), | ||
#' .by = c(aging_bin, ins_name)) | ||
#' | ||
#' @autoglobal | ||
#' | ||
#' @export | ||
bin_aging <- function(df, date) { | ||
|
||
df |> | ||
dplyr::mutate( | ||
dar = clock::date_count_between( | ||
{{ date }}, | ||
lubridate::today(), | ||
"day"), | ||
aging_bin = santoku::chop_width( | ||
dar, | ||
30, | ||
start = 0, | ||
left = FALSE, | ||
close_end = FALSE | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.