run_case: Run a full DCF case from a list or a YAML file

View source: R/config.R

run_caseR Documentation

Run a full DCF case from a list or a YAML file

Description

User-facing single entry point. Accepts either an in-memory config list or a config_file path to YAML. Both routes share the same validation and normalization pathway, ensuring identical downstream behavior.

Usage

run_case(
  config = NULL,
  config_file = NULL,
  debt_type = NULL,
  ltv_base = c("price_di", "price_ht", "value")
)

Arguments

config

Optional list configuration following the YAML grammar.

config_file

Optional path to a YAML configuration file. If both config and config_file are NULL, defaults to the package example at inst/extdata/config.yml.

debt_type

Optional debt schedule type to use ("bullet" or "amort"). When NULL (default), the normalized type inferred from the configuration is used. A non-NULL value overrides it.

ltv_base

Base for loan-to-value (LTV) and initial principal. One of "price_di", "price_ht", or "value".

Details

The function centralizes user ergonomics:

  • Reads either a list or a YAML file.

  • Validates and normalizes with cfg_validate() and cfg_normalize().

  • Computes the unlevered discounted cash flow (DCF), builds a debt schedule, computes leveraged metrics, and adds credit ratios to the full cash-flow table.

  • Handles capitalized arrangement fees by adjusting the scheduled principal to avoid double-counting.

Value

A list containing pricing (acquisition price net of taxes, acquisition costs, and acquisition price including costs), all-equity metrics, leveraged metrics, a comparison table, the full cash-flow table with credit ratios, and selected configuration flags.

Examples

# R list route
cfg <- dcf_spec_template()
cfg$leases <- list(
  list(
    unit = "U",
    area = 1000,
    events = list(
      list(
        start = cfg$purchase_year,
        end   = cfg$purchase_year + cfg$horizon_years,  # keep NOI positive in terminal year
        rent = 200,
        free_months = 0,
        capex_sqm = 0,
        vac = 0,
        new_lease = 0
      )
    )
  )
)
out <- run_case(config = cfg, debt_type = "bullet")
names(out)

cre.dcf documentation built on April 10, 2026, 5:08 p.m.