Learn R Programming

safetyGraphics (version 1.1.0)

validateSettings: Compare a settings object with a specified data set

Description

This function returns a list describing the validation status of a data set for a specified data standard

Usage

validateSettings(data, settings, charts = NULL)

Arguments

data

A data frame to check against the settings object

settings

The settings list to compare with the data frame.

charts

The charts being validated

Value

A list describing the validation state for the data/settings combination. The returned list has the following properties:

  • "valid" - boolean indicating whether the settings/data combo is valid for all charts

  • "status" - string summarizing the validation results

  • "charts" - a list of lists specifying whether each chart is valid. Each item in the list has "chart" and "valid" properties

  • "checkList" - list of lists giving details about checks performed on individual setting specifications. Each embedded item has the following properties:

    • "key" - list specifying the position of the property being checked. For example, `list("group_cols",1,"value_col")` corresponds to `settings[["group_cols"]][[1]][["value_col"]]`

    • "text_key" - list from `key` parsed to character with a "--" separator.

    • "value" - value of the setting

    • "type" - type of the check performed.

    • "description" - description of the check performed.

    • "valid" - boolean indicating whether the check was passed

    • "message" - string describing failed checks (where `valid=FALSE`). returns an empty string when `valid==TRUE`

Details

This function returns a list describing the validation status of a settings/data combo for a given chart type. This list can be used to populate status fields and control workflow in the Shiny app. It could also be used to manually QC a buggy chart. The tool checks that all setting properties containing "_col" match columns in the data set via checkColumnSettings, and all properties containing "_values" match fields in the data set via checkFieldSettings.

Examples

Run this code
# NOT RUN {
testSettings <- generateSettings(standard="adam")
validateSettings(data=adlbc, settings=testSettings)
# .$valid is TRUE
testSettings$id_col <- "NotAColumn"
validateSettings(data=adlbc, settings=testSettings)
# .$valid is now FALSE

# }

Run the code above in your browser using DataLab