Learn R Programming

BayesTools (version 0.3.0)

interpret_records: Normalize structured interpretation sources

Description

interpret_records normalizes interpretation inputs from one or more structured sources into traceable evidence, estimate, header, note, prior, and footnote records. It is intended for downstream packages that already own the domain-specific ordering and wording of an interpretation, but want BayesTools to consistently extract table rows, preserve Bayes-factor metadata, and carry traceability information.

Usage

interpret_records(
  sources,
  plan,
  output = c("records", "text"),
  missing = c("error", "skip", "warn"),
  method = NULL,
  digits = 3
)

interpret_tables(sources, spec, ...)

Value

interpret_records returns a data frame with class "BayesTools_interpret_records" when output = "records", or a character vector when output = "text". interpret_tables is a convenience wrapper around interpret_records.

Arguments

sources

named list of interpretation sources. Each source can be a data.frame/BayesTools_table, or a list with entries data, optional type, and optional per-source schema. Supported source types are "table", "record", and "records". Table schemas can define columns such as row, BF, central, lower, upper, and metadata such as BF_orientation, BF_scale, BF_name, BF_bound_operator, lower_prob, upper_prob, interval_level, units, and conditioning.

plan

ordered list specifying which records to create. Plan items can have kind = "evidence", "estimate", "pair", "test_estimate", "for_each", "header", "note", "prior", or "footnote". Pair items contain evidence and/or estimate references. Dynamic "for_each" items generate records from source row order.

output

whether to return normalized "records" or a simple generic "text" rendering. Downstream packages should usually request "records" and render domain-specific text themselves.

missing

how missing optional sources or rows should be handled.

method

optional method name used only by the generic text renderer.

digits

number of digits used only by the generic text renderer.

spec

alias for plan used by interpret_tables.

...

additional arguments passed from interpret_tables to interpret_records.