append_rating_factors: Append wide rating-step values to rated data

View source: R/trace_helpers.R

append_rating_factorsR Documentation

Append wide rating-step values to rated data

Description

Reshape normalized trace rows into wide applied-value columns and join them to the rated records.

Usage

append_rating_factors(rated_data, term_trace, by = "row_number")

Arguments

rated_data

A data frame containing rated policy or entity records.

term_trace

A data frame containing normalized rating trace rows.

by

A character vector naming the columns used both to reshape term_trace and to join the resulting wide data to rated_data. The default is "row_number".

Details

The function creates or replaces a row_number column in rated_data using its current row order.

Value

A data frame containing the rated records, a generated row_number column, and wide ⁠step_<number>_<term>⁠ columns containing applied step values.

Examples

ex <- example_rating_plan()

result <- rate_policies_with_trace(
  ex$policies,
  ex$plan
)

append_rating_factors(
  rated_data = result$rated_data,
  term_trace = result$term_trace,
  by = "row_number"
)

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