The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The chk_
functions (and their vld_
equivalents) can be divided into the following families. For reasons of
space, the x_name = NULL
argument is not shown.
Function | Code |
---|---|
chk_true(x) |
is.logical(x) && length(x) == 1L && !anyNA(x) && x |
chk_false(x) |
is.logical(x) && length(x) == 1L && !anyNA(x) && !x |
chk_flag(x) |
is.logical(x) && length(x) == 1L && !anyNA(x) |
chk_lgl(x) |
is.logical(x) && length(x) == 1L |
Function | Code |
---|---|
chk_scalar(x) |
length(x) == 1L |
chk_number(x) |
is.numeric(x) && length(x) == 1L && !anyNA(x) |
chk_whole_number(x) |
vld_number(x) && (is.integer(x) || vld_true(all.equal(x, trunc(x)))) |
chk_string(x) |
is.character(x) && length(x) == 1L && !anyNA(x) |
chk_date(x) |
inherits(x, "Date") && length(x) == 1L && !anyNA(x) |
chk_datetime(x) |
inherits(x, "POSIXct") && length(x) == 1L && !anyNA(x) |
chk_tz(x) |
is.character(x) && length(x) == 1L && !anyNA(x) && x %in% OlsonNames() |
Function | Code |
---|---|
chk_range(x, range = c(0, 1)) |
all(x[!is.na(x)] >= range[1] & x[!is.na(x)] <= range[2]) |
chk_lt(x, value = 0) |
all(x[!is.na(x)] < value) |
chk_lte(x, value = 0) |
all(x[!is.na(x)] <= value) |
chk_gt(x, value = 0) |
all(x[!is.na(x)] > value) |
chk_gte(x, value = 0) |
all(x[!is.na(x)] >= value) |
Function | Code |
---|---|
chk_identical(x, y) |
identical(x, y) |
chk_equal(x, y, tolerance = sqrt(.Machine$double.eps)) |
vld_true(all.equal(x, y, tolerance)) |
chk_equivalent(x, y, tolerance = sqrt(.Machine$double.eps)) |
vld_true(all.equal(x, y, tolerance, check.attributes = FALSE)) |
Function | Code |
---|---|
chk_all(x, chk_fun, ...) |
all(vapply(x, chk_fun, TRUE, ...)) |
chk_all_identical(x) |
length(x) < 2L || all(vapply(x, vld_identical, TRUE, y = x[[1]])) |
chk_all_equal(x, tolerance = sqrt(.Machine$double.eps)) |
length(x) < 2L || all(vapply(x, vld_equal, TRUE, y = x[[1]], tolerance = tolerance)) |
chk_all_equivalent(x, tolerance = sqrt(.Machine$double.eps)) |
length(x) < 2L || all(vapply(x, vld_equivalent, TRUE, y = x[[1]], tolerance = tolerance)) |
Function | Code |
---|---|
chk_setequal(x, values) |
setequal(x, values) |
chk_subset(x, values) |
all(x %in% values) |
chk_superset(x, values) |
all(values %in% x) |
chk_join(x, y, by) |
identical(nrow(x), nrow(merge(x, unique(y[if (is.null(names(by))) by else names(by)]), by = by))) |
Function | Code |
---|---|
chk_atomic(x) |
is.atomic(x) |
chk_function(x, formals = NULL) |
is.function(x) && (is.null(formals) || length(formals(x)) == formals) |
chk_numeric(x) |
is.numeric(x) |
chk_s3_class(x, class) |
!isS4(x) && inherits(x, class) |
chk_s4_class(x, class) |
isS4(x) && methods::is(x, class) |
chk_vector(x) |
is.vector(x) |
chk_whole_numeric(x) |
is.integer(x) || (is.double(x) && vld_true(all.equal(x, as.integer(x)))) |
chk_array(x) |
is.array(x) |
chk_matrix(x) |
is.matrix(x) |
chk_data(x) |
inherits(x, "data.frame") |
Function | Code |
---|---|
chk_environment(x) |
is.environment(x) |
chk_list(x) |
is.list(x) |
chk_logical(x) |
is.logical(x) |
chk_double(x) |
is.double(x) |
chk_integer(x) |
is.integer(x) |
chk_character(x) |
is.character(x) |
Function | Code |
---|---|
chk_null(x) |
is.null(x) |
chk_not_null(x) |
!is.null(x) |
Function | Code |
---|---|
chk_used(...) |
length(list(...)) != 0L |
chk_unused(...) |
length(list(...)) == 0L |
Function | Code |
---|---|
chk_file(x) |
vld_string(x) && file.exists(x) && !dir.exists(x) |
chk_ext(x, ext) |
vld_string(x) && vld_subset(tools::file_ext(x), ext) |
chk_dir(x) |
vld_string(x) && dir.exists(x) |
Function | Code |
---|---|
chk_match(x, regexp = ".+") |
all(grepl(regexp, x[!is.na(x)])) |
chk_named(x) |
!is.null(names(x)) |
chk_not_empty(x) |
length(x) != 0L |
chk_not_any_na(x) |
!anyNA(x) |
chk_unique(x, incomparables = FALSE) |
!anyDuplicated(x, incomparables = incomparables) |
chk_sorted(x) |
is.unsorted(x) |
Function
check_data(x, values = NULL, exclusive = FALSE, order = FALSE, nrow = numeric(0), key = character(0))
check_dim(x, dim = length, values = numeric(0), dim_name = NULL)
check_key(x, key = character(0), na_distinct = FALSE)
check_names(x, names = character(0), exclusive = FALSE, order = FALSE)
check_values(x, values)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.