-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[R] slice_sample returns 0 rows #38638
Comments
I think this is an implementation issue and we need to re-implement this differently; if I run this code repeatedly, sometimes I do get a number of rows equal or fewer to |
I have a probably related issue where If I specify the expected row count with a proportion: nr <- nrow(tbl_df)
slice_sample(tbl_df, prop = 100/nr) I encounter the above issue (not exactly 100 rows but sometimes fewer or more), but the rows are truly randomized. |
Thanks for the extra information there @lgaborini! I've looked at this again, and I think it's an unfortunate quirk of the original implementation (i.e. a known issue), as we've had to implement it a little differently as the C++ random function doesn't work, e.g. #14361 (comment). I've tried updating the There's this line that just takes the first |
I think that will work, although I don't know if it will be slower or faster than calling One can do a streaming (but approximate) sampling, too, which might be useful for non-statistical purposes (e.g., testing on something more realistic than the first |
Describe the bug, including details regarding any error messages, version, and platform.
Created on 2023-11-08 with reprex v2.0.2
Component(s)
R
The text was updated successfully, but these errors were encountered: