| checkDataFrame {checkmate} | R Documentation |
Check if an argument is a data frame
checkDataFrame(x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE) check_data_frame(x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE) assertDataFrame(x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL) assert_data_frame(x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, .var.name = vname(x), add = NULL) testDataFrame(x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE) test_data_frame(x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE) expect_data_frame(x, types = character(0L), any.missing = TRUE, all.missing = TRUE, min.rows = NULL, max.rows = NULL, min.cols = NULL, max.cols = NULL, nrows = NULL, ncols = NULL, row.names = NULL, col.names = NULL, null.ok = FALSE, info = NULL, label = vname(x))
x |
[any] |
types |
[ |
any.missing |
[ |
all.missing |
[ |
min.rows |
[ |
max.rows |
[ |
min.cols |
[ |
max.cols |
[ |
nrows |
[ |
ncols |
[ |
row.names |
[ |
col.names |
[ |
null.ok |
[ |
.var.name |
[ |
add |
[ |
info |
[character(1)] |
label |
[ |
Depending on the function prefix:
If the check is successful, the functions
assertDataFrame/assert_data_frame return
x invisibly, whereas
checkDataFrame/check_data_frame and
testDataFrame/test_data_frame return
TRUE.
If the check is not successful,
assertDataFrame/assert_data_frame
throws an error message,
testDataFrame/test_data_frame
returns FALSE,
and checkDataFrame returns a string with the error message.
The function expect_data_frame always returns an
expectation.
Other compound: checkArray,
checkDataTable, checkMatrix,
checkTibble
Other basetypes: checkArray,
checkAtomicVector,
checkAtomic, checkCharacter,
checkComplex, checkDate,
checkDouble,
checkEnvironment,
checkFactor, checkFormula,
checkFunction,
checkIntegerish,
checkInteger, checkList,
checkLogical, checkMatrix,
checkNull, checkNumeric,
checkPOSIXct, checkRaw,
checkVector
testDataFrame(iris)
testDataFrame(iris, types = c("numeric", "factor"), min.rows = 1, col.names = "named")