Skip to contents

Checks that all column names specified in "cols" are found in the data frame names (given by "dNames") and produces a neat error message if not

Usage

checkColNames(dNames, cols)

Arguments

dNames

Character vector of column names from a data frame

cols

Character vector of column names that should be found in the data frame

Value

A TRUE value (if all of "cols" are found in "dNames") or an exception if not

Author

Romain Francois

Examples


  checkColNames(LETTERS, "D")
#> [1] TRUE
  checkColNames(LETTERS, LETTERS[1:5])
#> [1] TRUE
  if (FALSE) {
    # Will show an error because "Hello" is not in LETTERS
    checkColNames(LETTERS, c("A", "Hello"))
  }