render_scenario_snapshot: Rendering a scenario snapshot

View source: R/render_scenario_snapshot.R

render_scenario_snapshotR Documentation

Rendering a scenario snapshot

Description

Rendering a scenario snapshot

Usage

render_scenario_snapshot(scenario, index = 0, currency = "", big_mark = " ")

Arguments

scenario

A tibble with nested columns - the result of simulate_scenario(). Data for a single scenario.

index

The index of the scenario year to render. By default, it is 0, which corresponds to the current year.

currency

The currency symbol to use as a suffix.

big_mark

The character to use as a big mark. It separates thousands.

Value

A gt::gt() object.

Examples

older_member <- HouseholdMember$new(
  name       = "older",  
  birth_date = "1980-02-15",
  mode       = 80,
  dispersion = 10
)  
household <- Household$new()
household$add_member(older_member)  

household$expected_income <- list(
  "income" = c(
    "members$older$age <= 65 ~ 9000 * 12"
  )
)
household$expected_spending <- list(
  "spending" = c(
    "members$older$age <= 65 ~ 5000 * 12",
    "TRUE ~ 4000 * 12"
  )
)

portfolio <- create_portfolio_template() 
portfolio$accounts$taxable <- c(10000, 30000)
portfolio <- 
  portfolio |> 
  calc_effective_tax_rate(
    tax_rate_ltcg = 0.20, 
    tax_rate_ordinary_income = 0.40
  )

scenario <- 
  simulate_scenario(
   household = household,
   portfolio = portfolio,
   current_date = "2020-07-15"
  )
render_scenario_snapshot(scenario)

R4GoodPersonalFinances documentation built on Aug. 8, 2025, 7:27 p.m.