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

slice_*: argument n and prop can be negative for all but slice_sample? #6402

Closed
MatthieuStigler opened this issue Aug 15, 2022 · 0 comments · Fixed by #6405
Closed

slice_*: argument n and prop can be negative for all but slice_sample? #6402

MatthieuStigler opened this issue Aug 15, 2022 · 0 comments · Fixed by #6405
Labels
feature a feature request or enhancement rows ↕️ Operations on rows: filter(), slice(), arrange()

Comments

@MatthieuStigler
Copy link

It seems that arguments n and prop are allowed to be negative (doc: If a negative value of n or prop is provided, ....) for all sample_* function except for slice_sample? Is that desired (yet undocumented?) behaviour, or an omission?

dplyr::slice_sample(iris, n=-1)
#> Error in `dplyr::slice_sample()`:
#> ! `n` must be positive.
``
hadley added a commit that referenced this issue Aug 16, 2022
@hadley hadley added feature a feature request or enhancement rows ↕️ Operations on rows: filter(), slice(), arrange() labels Aug 16, 2022
hadley added a commit that referenced this issue Aug 18, 2022
And generally improve logic by doing more work in `get_slice_size()`.

Fixes #6402
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement rows ↕️ Operations on rows: filter(), slice(), arrange()
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants