-
Notifications
You must be signed in to change notification settings - Fork 2
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
Questions #15
Comments
Yo! Hope you guys are well. A few comments:
filter_expect(mtcars, expect_range, disp, min = 0, max = 100)
#> Error: `data` has 27 records failing range check on variable `disp`.
#> Filter: None
#> Arguments: `<named list>`
set_testdata(mtcars)
expect_func(var = disp, func = chk_range, args = list(min = 0, max = 100))
#> Error: get_testdata() has 27 records failing `chk_range` on variable `disp`.
#> Filter: None
#> Arguments: `<named list>`
|
Hey! Thanks for this! That's really helpful. Given what you've said, my inclination is to fix up Do you have any thoughts? (Also feel free not to reply to this 😛 Al and I can work it out) |
No problemo! Yeah that sounds good to me, although I would leave |
Just looking at Is this right: expect_exclusive(vars = vars(a), exc_vars = vars(a, b, c, d)) fails for records where expect_exclusive(vars(a, b), vars(a, b, c, d)) fails for records where If so, would the following be equivalent: my_expect_exclusive <- function(vars, val, flt, data = get_testdata()) {
# Filter data to flt
# Check that each record has at most one of `vars` equal to `val`
}
my_expect_exclusive(vars = vars(a, b, c, d), val = 1, flt = a %in% 1) # Equivalent to the first expectation above
my_expect_exclusive(vars = vars(b, c, d), val = 1, flt = a %in% 1) # Not possible with the expectation above The second expectation would fail only if |
Yep that's how it should work. This is for "exclusive" response codes in multi response sets. So a common call might look like this: expect_exclusive(vars = vars(q1_11, q1_98, q1_99), exc_vars = vars(matches("^q1_"))) I prefer the current setup because using a filter isn't quite what we're doing conceptually (although that might be how it's done internally) - the current API call feels more natural, saying "make sure these variables are exclusive given this variable set". Could do with better argument naming though. |
Yeah, I see what you mean. It was initially counter-intuitive to me, and I had to look at the internals to figure out what it was doing. But I've added in documentation for it now, and I reckon it's fine as is with that as supplementation. Circling back to |
I think everything's been addressed here and I've finished going through testdat. Going to close this out. Can put up specific issues if anything further arises |
I have been going through the package, trying to get acquainted with all of the functions, and I have been coming across some that I don't understand / I don't think work / I don't see the utility of.
filter_expect
(link) - is supposed to receive an expectation function as an argument and return the input data frame filtered to records failing that expectation. But it doesn't work as expected with any of the expectation functions defined (see below). It doesn't appear to be used anywhere else in the package. Consider putting on the chopping block?expect_similar
(link) - looks like it's supposed to take two dataframes, join them, and then check categorical variables to see whether the proportion of data falling into each level matches. But it doesn't work (see below). It doesn't appear to be used anywhere else in the package. Consider putting on the chopping block?expect_func
(link)- I don't know what this function is supposed to do. It seems not to work? It's not used anywhere else in the package.expect-value
functions (link) - these functions are defined explicitly, but I don't see why. They have correspondingchk_*
functions, so why not use theexpect-make
approach?I'll keep adding to this issue as I find more functions like this
The text was updated successfully, but these errors were encountered: