farrange: A 'collapse' version of 'dplyr::arrange()'

View source: R/farrange.R

farrangeR Documentation

A collapse version of dplyr::arrange()

Description

This is a fast and near-identical alternative to dplyr::arrange() using the collapse package.

desc() is like dplyr::desc() but works faster when called directly on vectors.

Usage

farrange(data, ..., .by = NULL, .by_group = FALSE, .cols = NULL)

Arguments

data

A data frame.

...

Variables to arrange by.

.by

(Optional). A selection of columns to group by for this operation. Columns are specified using tidyselect.

.by_group

If TRUE the sorting will be first done by the group variables.

.cols

(Optional) alternative to ... that accepts a named character vector or numeric vector. If speed is an expensive resource, it is recommended to use this.

Details

farrange() is inspired by collapse::roworder() but also supports dplyr style data-masking which makes it a closer replacement to dplyr::arrange().

You can use desc() interchangeably with dplyr and timeplyr.
arrange(iris, desc(Species)) uses dplyr's version.
farrange(iris, desc(Species)) uses timeplyr's version.

farrange() is faster when there are many groups or a large number of rows.

Value

A sorted data.frame.


timeplyr documentation built on Sept. 12, 2024, 7:37 a.m.