The function generates define.xml metadata and
writes it to the file system. The function can generate a blank metadata
spreadsheet, a demonstration spreadsheet, or metadata read
from existing data files. The
type parameter can be used
to request an SDTM or ADAM spreadsheet.
write_metadata( dir, type = "sdtm", ver = NULL, src_dir = NULL, check = TRUE, demo = FALSE )
The directory in which to produce the metadata.
The type of metadata file to produce. Valid values are "SDTM" and "ADAM". Default is "SDTM".
The version of the metadata file. Default is the preferred version of the define standard. The function currently supports only version "2.0.0".
If the metadata will be generated from existing datasets, supply the directory path for those datasets. If the metadata will not be created from datasets, this parameter should be NULL. Datasets should be in XPT file format.
Whether or not to run the checks.
If this parameter is TRUE, the function will generate a metadata file populated with sample data. If the parameter is FALSE, a blank metadata spreadsheet will be produced. Default is FALSE.
The full path of the generated metadata file.
Frequently, organizations already have study metadata stored in Excel spreadsheets, and in the correct structure. This structure is used commonly in the industry by other software.
The purpose of the
write_metadata function is to create an
initial metadata template for studies in which you have no metadata.
This task will ensure that you have the proper metadata structure
to later create the define.xml.
By default, the function creates an unpopulated metadata spreadsheet.
demo parameter is set to TRUE, the function will create
the same spreadsheet populated with sample data. This sample data
can help you to understand how to populate the metadata for your study.
Note that this demo spreadsheet is populated correctly, and has no
conformance errors. Use this demo spreadsheet as a guide to fill
out your metadata.
The demo spreadsheet is included in the defineR package for convenience.
write_define to create a define.xml document and
# Get temporary directory tmp <- tempdir() # Create demo spreadsheet out1 <- write_metadata(tmp, demo = TRUE) # View file # file.show(out1) # Create unpopulated spreadsheet out2 <- write_metadata(tmp, demo = FALSE) # View file # file.show(out2)