Lagged rate of return
Examples
mock_provider(2020:2025) |>
dplyr::group_by(group) |>
rate_of_return(payment)
#> # A tibble: 12 × 4
#> year group payment payment_ror
#> <int> <chr> <int> <dbl>
#> 1 2020 A 18915 1
#> 2 2021 A 19851 1.05
#> 3 2022 A 19012 0.958
#> 4 2023 A 15197 0.799
#> 5 2024 A 10739 0.707
#> 6 2025 A 15862 1.48
#> 7 2020 B 19880 1
#> 8 2021 B 14034 0.706
#> 9 2022 B 18855 1.34
#> 10 2023 B 12059 0.640
#> 11 2024 B 12641 1.05
#> 12 2025 B 13568 1.07