Learn R Programming

safetyGraphics (version 1.1.0)

checkColumn: Check that a setting parameter has a matching data column

Description

Checks that a single parameter from the settings list matches a column name in a specified data set

Usage

checkColumn(key, settings, data)

Arguments

key

a list (like those provided by getSettingKeys()) defining the position of parameter in the settings object.

settings

The settings list used to generate a chart like eDISH()

data

A data frame to check for the specified column

Value

A list containing the results of the check following the format specified in validateSettings()[["checkList"]]

Details

This function compares settings with column names as part of the validateSettings() function. More specifically, the function checks whether the key in a settings object matches a column in "data".

Examples

Run this code
# NOT RUN {
testSettings<-generateSettings(standard="AdAM")
testSettings$filters<-list()
testSettings$filters[[1]]<-list(value_col="RACE",label="Race")
testSettings$filters[[2]]<-list(value_col=NULL,label="No Column")
testSettings$filters[[3]]<-list(value_col="NotAColumn",label="Invalid Column")

#pass ($valid == TRUE)
safetyGraphics:::checkColumn(key=list("id_col"),
                                    settings=testSettings, adlbc)

#pass
safetyGraphics:::checkColumn(key=list("filters",1,"value_col"),
                                    settings=testSettings, adlbc)

#NULL column pass
safetyGraphics:::checkColumn(key=list("filters",2,"value_col"),
                                    settings=testSettings, adlbc)

#invalid column fails
safetyGraphics:::checkColumn(key=list("filters",3,"value_col"),
                                    settings=testSettings, adlbc)
# }

Run the code above in your browser using DataLab