Preserves the portion of the total held by the column that is being rebalanced.

rebalance_premiums(
  the_data,
  column_name_to_rebalance,
  total_to_rebalance_to,
  do_keep_column_name = TRUE
)

Arguments

the_data

data.frame

column_name_to_rebalance

character reflecting the name of the (numeric) column that is being rebalanced

total_to_rebalance_to

numeric

do_keep_column_name

boolean If FALSE, then automatically renames to "column_name_rebalanced"

Value

data.frame

Examples

data.frame(premiums = 1:3) %>% rebalance_premiums("premiums", 12)
#> premiums #> 1 2 #> 2 4 #> 3 6
# Returns data.frame(premiums = c(2, 4, 6))