-
Notifications
You must be signed in to change notification settings - Fork 34
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
Would a verify_if make sense? #40
Comments
In the hypothetical code in the last line of your comment, it would just check
or
|
My hypothetical code is nonsense of course since it wasn't my intention to just check So my use-case would be to check if all numeric columns (which are currently e.g. stored as double) are really all integers before converting them to integers. And all that without providing the column names. The column name part disqualifies your first solution. Your second solution is fine. It just does not completely adhere to the df %>% assert_if(is.numeric, is_int) But really, df %>% assert_(is_int, names(df)[sapply(df, is.numeric)]) is fine! |
Here are some other alternatives!
and
By careful with the last one, though–it'll make I consider this good enough for now because we're working on some other cool features. I'll reinvestigate potentially adding *_if functions afterwards. Is it ok with you if I close this issue for now? |
Of course, this certainly isn't mission-critical. |
Consider the following data.frame
Suppose I want to verify whether all numeric/double columns are really integers. For one column I could do:
(See http://stackoverflow.com/a/10114392)
But if I want to verify this for multiple columns (I guess) I would have to use the (IMHO) rather verbose:
So wouldn't a
verify_if
, along the lines of dplyr'sselect_if
andmutate_if
, be a good idea? :)Or am I missing something?
The text was updated successfully, but these errors were encountered: