Reads a Pinnacle 21 Excel specification, Define-XML, or herald JSON
spec file and returns a herald_spec object. Auto-detects format
from file extension: .xlsx for P21 Excel, .xml for
Define-XML, .json for herald JSON spec.
See also
Other specification:
apply_spec(),
coerce_types(),
decode_var(),
detect_adam_class(),
detect_adam_classes(),
drop_unspec_vars(),
herald_spec(),
order_cols(),
read_spec_define(),
scaffold_vars(),
sort_keys(),
spec_codelist(),
spec_datasets(),
spec_study(),
spec_vars(),
write_define_html(),
write_define_xml(),
write_spec()
Examples
# Round-trip: build a spec, write to JSON, read back
if (requireNamespace("jsonlite", quietly = TRUE)) {
tmp <- tempfile(fileext = ".json")
on.exit(unlink(tmp), add = TRUE)
spec <- herald_spec(
ds_spec = data.frame(dataset = "DM", label = "Demographics",
stringsAsFactors = FALSE),
var_spec = data.frame(dataset = "DM", variable = c("STUDYID", "USUBJID"),
label = c("Study Identifier", "Unique Subject Identifier"),
data_type = c("text", "text"),
stringsAsFactors = FALSE)
)
write_spec(spec, tmp)
spec2 <- read_spec(tmp)
spec2
}
#>
#> ── herald_spec ──
#>
#> • Dataset: 1
#> • Variables: 2
#> Datasets: "DM"
