R/arrange_dt.R

Defines functions arrange_dt

Documented in arrange_dt

#' @title Arrange entries in data.frame
#' @description Order the rows of a data frame rows by the values of selected columns.
#' @param .data data.frame
#' @param ... Arrange by what group? Minus symbol means arrange by
#' descending order.
#' @return data.table
#' @seealso \code{\link[dplyr]{arrange}}
#' @examples
#'
#' iris %>% arrange_dt(Sepal.Length)
#'
#' # minus for decreasing order
#' iris %>% arrange_dt(-Sepal.Length)
#'
#' # arrange by multiple variables
#' iris %>% arrange_dt(Sepal.Length,Petal.Length)
#'

#' @export

arrange_dt = function(.data,...){
  dt = as_dt(.data)
  dt[order(...)]
}

Try the tidyfst package in your browser

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

tidyfst documentation built on Sept. 16, 2024, 9:06 a.m.