util_expect_data_frame {dataquieR} | R Documentation |
Verify, that argument is a data frame
Description
stops with an error, if not. will add the columns, and return the resulting
extended data frame, and also updating the original data frame in the
calling environment, if #' x
is empty (data frames easily break to
0-columns in R, if they have not rows, e.g. using some split
/rbind
pattern)
Usage
util_expect_data_frame(
x,
col_names,
convert_if_possible,
custom_errors,
dont_assign,
keep_types = FALSE
)
Arguments
x |
an object that is verified to be a |
col_names |
column names x must contain or named list of predicates to check the columns (e.g., list(AGE=is.numeric, SEX=is.character)) |
convert_if_possible |
if given, for each column, a lambda can be given
similar to |
custom_errors |
list with error messages, specifically per column. names of the list are column names, values are messages (character). |
dont_assign |
set |
keep_types |
logical keep types as possibly defined in a file, if the
data frame is loaded from one. set |
Value
invisible
data frame