Description Usage Arguments Value Errors Examples
View source: R/check_numeric_object.R
check_numeric_object
returns TRUE
if an object
can be a numeric value. It returns true
if the object
is numeric
or if it detects numeric values in character form,
such as "1", "3.4", "-76", etc.
If with_bool
is set to TRUE
, check_numeric_object
assumes booleans
can also have an equivalent numeric form (being 1 and 0).
1 | check_numeric_object(object, with_bool = FALSE)
|
object |
an object (size-1 vector) of type numeric, character, or boolean. |
with_bool |
bool. Specifies whether we consider booleans as numeric values. |
This function returns True if the object can be converted to an equivalent numeric form.
If the object
is of type factor
then check_numeric_object
, and any
of the numericColumns
family of functions, won't be able to detect whether the
object can be numeric.
Errors: Must be given vectors of size = 1, otherwise the return values maybe of unexpected size.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
check_numeric_object(1)
[1] TRUE
check_numeric_object("-2.7")
[1] TRUE
check_numeric_object("bacon1")
[1] FALSE
check_numeric_object(TRUE)
[1] FALSE
check_numeric_object(TRUE, with_bool = TRUE)
[1] TRUE
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.