Learn R Programming

datacheckr (version 0.2.0.9002)

check_cols: Check Cols

Description

Checks the names and order of columns in data.

Usage

check_cols(data, colnames = NULL, exclusive = FALSE, ordered = FALSE,
  data_name = substitute(data))

Arguments

data
The data frame to check.
colnames
A character vector of the column names.
exclusive
A flag indicating whether data can include additional columns.
ordered
A flag indicating whether the order of the columns has to match.
data_name
A string of the name of data.

Value

Throws an informative error or returns an invisible copy of the data.

Details

By default (colnames = NULL) data must include at least one column. To check for no columns set colnames = character(0).