powered by
Checks if non-missing integer scalar or double equivalent using
vld_number(x) && (is.integer(x) || vld_true(all.equal(x, trunc(x))))
Pass: 1, 2L, 1e10, -Inf
1
2L
1e10
-Inf
Fail: "a", 1:3, NA_integer_, log(10)
"a"
1:3
NA_integer_
log(10)
chk_whole_number(x, x_name = NULL)vld_whole_number(x)
vld_whole_number(x)
The chk_ function throws an informative error if the test fails or returns the original object if successful so it can used in pipes.
chk_
The vld_ function returns a flag indicating whether the test was met.
vld_
The object to check.
A string of the name of object x or NULL.
vld_whole_number(): Validate Whole Number
vld_whole_number()
is.integer()
vld_true()
vld_number()
For more details about the use of this function, please read the article vignette("chk-families").
vignette("chk-families")
Other scalar_checker: chk_complex_number()
chk_complex_number()
Other whole_number_checkers: chk_count(), chk_whole_numeric()
chk_count()
chk_whole_numeric()
# chk_whole_number chk_whole_number(2) try(chk_whole_number(1.1)) # vld_whole_number vld_whole_number(2)
Run the code above in your browser using DataLab