getMetadata: Read metadata file

View source: R/reporting-metadata.R

getMetadataR Documentation

Read metadata file

Description

Read the metadata file from a yaml format. This function checks for existance of the metadata file and its content. In particular, within the yaml file matches the following strings:

  • path: Path to the data. More than one path is allowed.

  • dateTime: Date and time, usually of the SDTM data creation. When printing the metadata in Rmd document, there is the possibility to add the date and time of the report generation. See knit_print.clinDataReviewMetadata.

  • datasetInfo: General information about the data sets.

Usage

getMetadata(filePath, namesInfo)

Arguments

filePath

String of path to file. Currently only one file path is supported. If more than one paths are provided, a warning will be printed and the first path will be used.

namesInfo

Named vector to rename the final output when printed in Rmd. The renaming happens only if the metadata info are printed in Rmd and not in the console.

Details

Note that the input names do not necessarly have to match the exact names. For instance, the user can also write "dataTimeMySDTMData", and the function will parse for existance of the string "dataTime".

Value

A list of:

  • summaryInfo Information extracted from the inputs path, and dateTime.

  • datasetInfo Information extracted from datasetInfo.

Examples

# Create temporary yaml file
tmpdir <- tempdir()
library(yaml)

tmpYamlFile <- tempfile(
    pattern = "file", tmpdir = tempdir(), fileext = ".yml"
)
listArgs <- list(
    pathSDTMs = "path/To/SDTM",
    pathSDTMReformat = "path/To/SDTMReformat",
    dateTime = "20200101",
    datasetInfo = list(
        list(
            column1 = "ex.xpt",
            column2 = "20200101"
        ),
        list(
            column1 = "sl.xpt",
            column2 = "20200101",
            column3 = "OK"
        )
    )
)
write_yaml(
    listArgs,
    file = tmpYamlFile
)

# Run metadata
# Note: the 'datasetInfo' can also contain empty elements
getMetadata(filePath = tmpYamlFile)

clinDataReview documentation built on June 22, 2024, 10:03 a.m.