Skip to contents

slice a tibble by an ordered vector

Usage

ordered_slice(df, by, ordered_vector, na.rm = FALSE, dup.rm = FALSE)

Arguments

df

tibble

by

slice by this column, this value must has no duplicated value

ordered_vector

ordered vector

na.rm

remove NA or unknown values from ordered vector

dup.rm

remove duplication values from ordered vector

Value

sliced tibble

Examples

ordered_slice(mini_diamond, id, c("id-3", "id-2"))
#> # A tibble: 2 × 7
#>   id    carat cut   clarity price     x     y
#>   <chr> <dbl> <chr> <chr>   <int> <dbl> <dbl>
#> 1 id-3   0.52 Ideal VVS1     2029  5.15  5.18
#> 2 id-2   1.51 Good  VS2     11746  7.27  7.18