Lagged percentage change
Examples
fuimus:::provider_data(2020:2025) |>
dplyr::mutate(change = chg_pct(net_payment),
.by = group)
#> # A tibble: 12 × 4
#> year group net_payment change
#> <int> <chr> <int> <dbl>
#> 1 2020 A 17963 0
#> 2 2021 A 11839 -0.341
#> 3 2022 A 19177 0.620
#> 4 2023 A 11314 -0.410
#> 5 2024 A 18321 0.619
#> 6 2025 A 13926 -0.240
#> 7 2020 B 17017 0
#> 8 2021 B 18834 0.107
#> 9 2022 B 11829 -0.372
#> 10 2023 B 16595 0.403
#> 11 2024 B 10745 -0.353
#> 12 2025 B 12624 0.175