Skip to content

slice_min now returns all tibble values when prop = 0 #6184

Closed
@sagrules

Description

@sagrules

On update to dplyr 1.0.8 now when you use slice_min with prop = 0 it returns the whole tibble, it used to return an empty tibble which I think is the intended result by users.

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

d <- tibble(a=c(1,2,3,4,5,6,7,8,9,10),
            b=rep("x", 10))

d %>% 
  slice_min(
    order_by = a,
    prop = 0,
    with_ties = FALSE)
#> # A tibble: 10 x 2
#>        a b    
#>    <dbl> <chr>
#>  1     1 x    
#>  2     2 x    
#>  3     3 x    
#>  4     4 x    
#>  5     5 x    
#>  6     6 x    
#>  7     7 x    
#>  8     8 x    
#>  9     9 x    
#> 10    10 x

<sup>Created on 2022-02-11 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)</sup>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorrows ↕️Operations on rows: filter(), slice(), arrange()

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions