Order rows in ascending or descending order.
arrange(.df, ...)
df <- data.table(
a = 1:3,
b = 4:6,
c = c("a", "a", "b")
)
df %>%
arrange(c, -a)
#> # A tidytable: 3 × 3
#> a b c
#> <int> <int> <chr>
#> 1 2 5 a
#> 2 1 4 a
#> 3 3 6 b
df %>%
arrange(c, desc(a))
#> # A tidytable: 3 × 3
#> a b c
#> <int> <int> <chr>
#> 1 2 5 a
#> 2 1 4 a
#> 3 3 6 b