R/desc.R

Defines functions desc

Documented in desc

#' Descending order
#'
#' @description
#' Arrange in descending order. Can be used inside of `arrange()`
#'
#' @param x  Variable to arrange in descending order
#'
#' @export
#'
#' @examples
#' df <- data.table(
#'   a = 1:3,
#'   b = 4:6,
#'   c = c("a", "a", "b")
#' )
#'
#' df %>%
#'   arrange(c, desc(a))
desc <- function(x) {
  -xtfrm(x)
}

#' @export
#' @keywords internal
#' @inherit desc
desc. <- desc

Try the tidytable package in your browser

Any scripts or data that you put into this service are public.

tidytable documentation built on Oct. 5, 2023, 5:07 p.m.