Transform Budget Data to Wide Format with Derived Variables
Source:R/budget-transform.R
budget_transform.RdTransforms long-format budget data into a wide, analysis-ready master dataset with one row per classroom-year. Adds derived variables including category totals, percentage shares, and delivery type groupings.
Usage
budget_transform(
budget_long_obj,
add_groups = TRUE,
add_shares = TRUE,
allocate_payroll = TRUE
)Arguments
- budget_long_obj
An
alprek_budget_longobject frombudget_clean().- add_groups
Logical. Add delivery type groupings (binary and 3-way)? Default is
TRUE.Logical. Add percentage share columns? Default is
TRUE.- allocate_payroll
Logical. Allocate payroll taxes proportionally to lead/aux teacher benefits? Applies only to legacy format. Default is
TRUE.
Value
An alprek_budget_master S3 object (list) with elements:
data: tibble in wide format, one row per classroom-year.meta: list of metadata.
Examples
if (FALSE) { # \dontrun{
raw <- budget_read("rptClassBudgets 2023-2024.xlsx", "2023-2024")
cleaned <- budget_clean(raw)
master <- budget_transform(cleaned)
master$data
} # }