Skip to contents

Usage

geomean(x)

Arguments

x

numeric vector

Examples

x <- fuimus:::provider_data(2020:2025)

x |>
dplyr::group_by(group) |>
rate_of_return(net_payment)
#> # A tibble: 12 × 4
#>     year group net_payment net_payment_ror
#>    <int> <chr>       <int>           <dbl>
#>  1  2020 A           18784           1    
#>  2  2021 A           18634           0.992
#>  3  2022 A           18064           0.969
#>  4  2023 A           19504           1.08 
#>  5  2024 A           13034           0.668
#>  6  2025 A           16400           1.26 
#>  7  2020 B           13448           1    
#>  8  2021 B           19808           1.47 
#>  9  2022 B           13279           0.670
#> 10  2023 B           19570           1.47 
#> 11  2024 B           10257           0.524
#> 12  2025 B           13827           1.35 

x |>
dplyr::group_by(group) |>
rate_of_return(net_payment) |>
dplyr::summarise(gmean = geomean(net_payment_ror),
.by = group)
#> # A tibble: 2 × 2
#>   group gmean
#>   <chr> <dbl>
#> 1 A     0.978
#> 2 B     1.00