Skip to contents

Serialises a herald_spec object to a herald JSON file. Requires the jsonlite package.

Usage

write_spec(spec, path, ...)

Arguments

spec

A herald_spec object.

path

Output file path (must end in .json).

...

Reserved for future extensions.

Value

The output path (invisibly).

Examples

spec <- herald_spec(
  ds_spec  = data.frame(dataset = "DM", label = "Demographics",
                        stringsAsFactors = FALSE),
  var_spec = data.frame(dataset = "DM", variable = "STUDYID",
                        label = "Study ID", data_type = "text",
                        length = "12", stringsAsFactors = FALSE)
)
tmp <- tempfile(fileext = ".json")
on.exit(unlink(tmp))
write_spec(spec, tmp)