Learn R Programming

safetyGraphics (version 0.7.3)

compare_cols: Compares contents of 2 vectors

Description

Function to compare contents of 2 vectors - used to summarize of which data columns are found in a given standard. Used in detectStandard() and validateSettings()

Usage

compare_cols(data_cols, standard_cols)

Arguments

data_cols

A character vector with column names in the data frame

standard_cols

A character vector with column names in the data standard

Value

A list summarizing the comparison between data_cols and standard_cols. List has character vectors for "matched_columns", "extra_columns" and "missing_columns" parameters, and a boolean "match" parameter indicating that there are no missing columns.

Examples

Run this code
# NOT RUN {
#match == FALSE
safetyGraphics:::compare_cols(data_cols=c("a","b","c"),
                              standard_cols=c("d","e","f")) 

# match == TRUE
safetyGraphics:::compare_cols(names(adlbc),
                              safetyGraphics:::getRequiredColumns(standard="ADaM")) 

# }

Run the code above in your browser using DataLab