-
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.
Add reference files to targets pipeline
Also add cip_program_data_summary target
- Loading branch information
1 parent
dd3f79f
commit e28fcec
Showing
3 changed files
with
87 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#' Summarise CIP data by fiscal year | ||
#' | ||
#' [summarise_cip_data_fy()] wraps [dplyr::summarise()] to combine fiscal year | ||
#' amount columns grouped by some other variables. | ||
#' | ||
#' @param data Input data frame with numeric fiscal year columns. | ||
#' @param fy_col_prefix String that the fiscal year columns start with. Passed | ||
#' to [tidyselect::starts_with()] and is not case sensitive. | ||
#' @returns A data frame with FY columns summed by the column names passed to | ||
#' .by | ||
summarise_cip_data_fy <- function(data, | ||
.by = NULL, | ||
fy_col_prefix = "FY", | ||
na.rm = TRUE) { | ||
data |> | ||
summarise( | ||
across( | ||
starts_with(fy_col_prefix), | ||
\(x) { | ||
sum(x, na.rm = na.rm) | ||
} | ||
), | ||
.by = all_of(.by) | ||
) | ||
} |
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