-
Notifications
You must be signed in to change notification settings - Fork 80
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
rep_sample_n() fix (#279) #325
Conversation
also adds a new rep_slice_sample wrapper that has a more similar interface to dplyr::slice_sample(). still need to extend unit testing and rewrite examples.
Codecov Report
@@ Coverage Diff @@
## develop #325 +/- ##
===========================================
- Coverage 99.91% 99.91% -0.01%
===========================================
Files 15 15
Lines 1227 1222 -5
===========================================
- Hits 1226 1221 -5
Misses 1 1
|
By the way, the setup-R step on |
With regard to getting this back to 100% coverage, don't you just need to set |
document argument aliases in the same param rather than duplicating descriptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New implementation uses the most recent features of {dplyr} 1.0.0: slice_sample()
and .before
in mutate()
. This is good in every day usage, but not necessarily so in package development, as {infer} will not work with version of {dplyr} less than 1.0.0. I believe this is not so big of a problem, as most of {infer} users will have latest {dplyr} version, but it still seems to be a good idea to not rely on very recent {dplyr} features. Nevertheless, thank you @unoe for your help! It is much appreciated.
It seems that removing these lines, as per @rudeboybert's original doubts, should have been enough. But still the work of redocumenting and adding tests is very useful. Thanks, @simonpcouch!
I'll add some changes and request re-review.
Update: @simonpcouch, could you, please, take a look at my changes?
I completely understand your points and agree, @echasnovski, and thanks for all your work and help @simonpcouch. |
… make weighting more prominent
Looks great! Thanks for the changes, @echasnovski. Since @ismayc has given the thumbs up on both this PR and #326, I'm going to go ahead and merge #326 here and then this PR to |
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
Alright, here’s a go at a fix for 279! This approach borrows heavily from @unoe’s implementation, and relies on the
slice_sample()
implementation from dplyr for most argument checking and errors.All previous unit tests pass, and I've extended the testing a bit so that we'd hopefully catch an issue like 279 earlier on if one came up again. There's also some documentation clarification. From what I can tell,
rep_sample_n()
never checked that the suppliedprob
s summed to one, so I changed the docs to refer toprob
as sampling weights.This also adds a
rep_slice_sample()
function, as @mine-cetinkaya-rundel recommended, that is a light wrapper aroundrep_sample_n()
that more closely resembles the interface todplyr::slice_sample()
. I only changed argument names and ordering here.🦋Created on 2020-07-24 by the reprex package (v0.3.0.9001)
It also looks like codecov is picking up on not having any testing for the noLD check (not from this PR)—not sure what unit testing for that feature would look like.