Skip to content

[R] Add test for slice_sample with prop = 1 edge case #48658

@HyukjinKwon

Description

@HyukjinKwon

Describe the enhancement requested

The TODO comment in test-dplyr-slice.R asked whether the edge case where prop = 1 should be explicitly handled. The current implementation already correctly handles this case: when prop = 1, the if (prop < 1)
condition is false, so no filtering occurs and all data is returned.

if (prop < 1) {

The TODO was introduced in commit 80e3986 when implementing slice_sample():

# TODO: handle edge case where prop = 1, do nothing?

This commit added both the if (prop < 1) behavior and the TODO comment, questioning whether the implicit behavior (doing nothing when prop = 1) was correct.

Component(s)

R

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions