as_evidence: Coerce to Evidence Table

View source: R/evidence_schema.R

as_evidenceR Documentation

Coerce to Evidence Table

Description

Takes a data.frame and coerces it into a valid evidence table. Fills in missing nullable columns with NA of the correct type and validates controlled vocabulary columns.

Usage

as_evidence(x, ctx = NULL, ...)

Arguments

x

A data.frame (or tibble) with at least the required evidence columns.

ctx

An optional r4sub_run_context. If provided, run_id and study_id are filled from the context when missing.

...

Additional columns to set (e.g., asset_type = "validation").

Value

A data.frame conforming to the evidence schema.

Examples

ctx <- r4sub_run_context("STUDY1", "DEV")
df <- data.frame(
  asset_type = "validation",
  asset_id = "ADSL",
  source_name = "pinnacle21",
  indicator_id = "P21-001",
  indicator_name = "Missing variable",
  indicator_domain = "quality",
  severity = "high",
  result = "fail",
  message = "Variable AGEU missing",
  stringsAsFactors = FALSE
)
ev <- as_evidence(df, ctx = ctx)


r4subcore documentation built on Feb. 20, 2026, 5:09 p.m.