check_data_frame: Check data.frame validity

View source: R/input-check.R

check_data_frameR Documentation

Check data.frame validity

Description

Checks whether the input data.frame contains variables of certain classes and names.

Usage

check_data_frame(
  df,
  var.class = list(),
  ref = NULL,
  verbose = TRUE,
  with.time = FALSE,
  fdb.fn = "stop"
)

Arguments

df

A data.frame.

var.class

A named list. The names have to match the variable names of the data.frame that are to be validated. The respective elements specify the class the data.frame variable must have specified as character strings.

ref

Character value. Input reference for the error message. If set to NULL the value of x is evaluated via non standard evalulation.

verbose

Logical value. Indicates whether any kind of feedback is supposed to be given. verbose set to FALSE shuts down any error, warning or general messages and results in the functions returning what is specified in return.

with.time

Logical value. Indicates whether the current time is to be added to the feedback message.

fdb.fn

Character value. Determines the function to call if a feedback message needs to be given. One of 'stop', 'warning' or 'message'.

Value

An informative message, warning or error or TRUE if valid.

Examples

 # make sure that the input data.frame has
 # the numeric variables 'mpg' and 'cyl'.

 check_data_frame(df = mtcars,
                  var.class = list(mpg = "numeric",
                                   cyl = "numeric"))

kueckelj/confuns documentation built on July 4, 2024, 4:53 p.m.