markfairbanks / tidytable

Tidy interface to 'data.table'
https://markfairbanks.github.io/tidytable/
Other
449 stars 33 forks source link

Add `with_ties` arg to `slice_min`/`slice_max` #548

Closed markfairbanks closed 2 years ago

markfairbanks commented 2 years ago
pacman::p_load(tidytable)

df <- tidytable(x = c(2, 1, 4, 1))

df %>%
  dplyr::slice_min(x, n = 1)
#> # A tidytable: 2 × 1
#>       x
#>   <dbl>
#> 1     1
#> 2     1

df %>%
  dplyr::slice_min(x, n = 1, with_ties = FALSE)
#> # A tidytable: 1 × 1
#>       x
#>   <dbl>
#> 1     1