Skip to contents

Returns the rows from var_spec that belong to the specified dataset, ordered by the order column if present.

Usage

spec_vars(spec, dataset)

Arguments

spec

A herald_spec object.

dataset

A single dataset name (character string).

Value

A data frame of variable specifications for the requested dataset.

Examples

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 ID", "Subject ID"), order = 1:2,
                        stringsAsFactors = FALSE)
)
spec_vars(spec, "DM")
#>   dataset variable      label order
#> 1      DM  STUDYID   Study ID     1
#> 2      DM  USUBJID Subject ID     2