find_duplicate_factors: Find duplicate factor-table rows

View source: R/validation.R

find_duplicate_factorsR Documentation

Find duplicate factor-table rows

Description

Identify factor-table rows that have duplicate lookup keys.

Usage

find_duplicate_factors(factor_table, max_vars = 12, ...)

Arguments

factor_table

A normalized long-form factor table.

max_vars

Maximum number of variable-level slot pairs to inspect.

...

Additional arguments accepted for backward compatibility.

Value

A data frame containing factor-table rows with duplicated lookup keys. An empty data frame is returned when no duplicates are found.

Examples

factor_table <- data.frame(
  state = c("IL", "IL", "IL"),
  coverage = c("BI", "BI", "BI"),
  term_name = c("territory", "territory", "territory"),
  term_value = c(1.10, 1.15, 0.95),
  variable1 = c("territory", "territory", "territory"),
  level1 = c("A", "A", "B"),
  stringsAsFactors = FALSE
)

duplicates <- find_duplicate_factors(
  factor_table,
  max_vars = 1
)

duplicates[
  ,
  c(
    "state",
    "coverage",
    "term_name",
    "term_value",
    "variable1",
    "level1"
  )
]

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