Closed harell closed 3 years ago
Hi @harell
Thanks for your feedback.
chk_whole_numeric()
is the function you want to use to test if a vector consists of whole numbers
Note chk_integer()
checks if a vector is of class integer.
Also to preserve the case of x_name add backticks
> chk::chk_true(1, x_name = "Account_Id")
Error: Account_Id must be TRUE.
chk::chk_true(1, x_name = "`Account_Id`")
Error: `Account_Id` must be TRUE.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
Hi
Love your work on the chk package, one question please.
Say I have a vector
account_id
that has contain whole numbers, what is an elegant way to test it?I could run one element at a time for example:
but then when an error occurs, the var name is obscured
I can overcome it by specifying the var name
but this solution is not elegant. Importantly, it is cumbersome to implement when there are many vectors to check, e.g. a data frame.
Also, the error modifies the var name (notice capital 'A' in the error, while the original name starts with lower case 'a')