lookup_factor_value: Look up a factor value by source

View source: R/lookup.R

lookup_factor_valueR Documentation

Look up a factor value by source

Description

Dispatch a rating-table lookup to either exact matching or interpolated lookup according to value_source.

Usage

lookup_factor_value(
  row,
  coverage,
  plan,
  term_name,
  value_source = "factor_lookup",
  lookup_var = NULL,
  bounds = "error"
)

Arguments

row

A one-row data frame containing the rating record.

coverage

A character string identifying the coverage being rated.

plan

A rating_plan object created by new_rating_plan().

term_name

A character string identifying the rating term to look up.

value_source

A character string specifying the lookup method. Supported values are "factor_lookup" and "interpolated_lookup".

lookup_var

An optional character string naming the interpolation variable. Required for value_source = "interpolated_lookup".

bounds

A character string controlling out-of-range interpolation. Supported values are "error", "clamp", and "extrapolate".

Value

A list containing the selected or interpolated rating value and associated trace information.

Examples

ex <- example_rating_plan()
policy <- ex$policies[1, , drop = FALSE]

answer <- lookup_factor_value(
  row = policy,
  coverage = "BI",
  plan = ex$plan,
  term_name = "territory",
  value_source = "factor_lookup"
)

answer

ratingtables documentation built on Sept. 6, 2026, 1:06 a.m.