Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use consistent input checking #24

Open
Deleetdk opened this issue Nov 23, 2016 · 4 comments
Open

Use consistent input checking #24

Deleetdk opened this issue Nov 23, 2016 · 4 comments

Comments

@Deleetdk
Copy link
Owner

Right now input checks are chaotically written using a variety of methods. Some use my own functions, others use assertthat functions. It's better to reuse well-tested code, so switch to assertthat functions. Fill in with missing tests.

@Deleetdk
Copy link
Owner Author

@Deleetdk
Copy link
Owner Author

Deleetdk commented Jan 31, 2017

Actually I quite like the is_ function. Flexible. Can be made more flexible by adding the half equation, math function support. Maybe use a formula e.g. ~<2 is shorthand for x<2, where x is the variable.

@Deleetdk
Copy link
Owner Author

I deleted check_missing. Pointless function. All one has to do is call each of the arguments. If it's actually missing, R displays the standard missing argument error to the user.

@Deleetdk
Copy link
Owner Author

Deleetdk commented Feb 3, 2017

Neither package turned out to be useful for my purposes. assertthat has no easy way to make custom error messages, it has to be done in some complicated functional way. ensurer has the same problem, except it's worse.

So I rolled my own simple function: fail_if. It simply evaluates the input and throws an error with a custom message message if it is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant