Skip to contents

Convenience constructor for tests, examples, and documentation. The input is a YAML string whose top-level keys are herald_spec() slot names (ds_spec, var_spec, value_spec, codelist, methods, comments, documents, study, dictionaries, arm_displays, arm_results). Each key is an array of objects, one per row, with field names matching the corresponding data frame columns.

Usage

herald_spec_from_fixture(yaml_text)

Arguments

yaml_text

A scalar character string of YAML.

Value

A herald_spec object.

Details

Coercion is delegated to jsonlite::fromJSON(..., simplifyDataFrame = TRUE), which handles heterogeneous objects by padding absent fields with NA. All subsequent validation (required slot presence, schema conformance) is delegated to herald_spec().

Examples

spec <- herald_spec_from_fixture("
ds_spec:
  - {dataset: DM, label: Demographics}
var_spec:
  - {dataset: DM, variable: STUDYID, label: Study ID,
     data_type: text, length: 12}
")