| clean_int | R Documentation |
Clean integer input
clean_int(x, xname = deparse(substitute(x)))
x |
Double or integer vector to check. |
xname |
Character: Name of the variable for error messages. |
The goal is to return an integer vector. If the input is integer, it is returned as is. If the input is numeric, it is coerced to integer only if the numeric values are integers, otherwise an error is thrown.
Integer vector.
EDG
clean_int(6L)
clean_int(3)
# clean_int(12.1) # Error
clean_int(c(3, 5, 7))
# clean_int(c(3, 5, 7.01)) # Error
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.