sort.data.frame: Sort rows of a data frame

View source: R/data_frames.R

sort.data.frameR Documentation

Sort rows of a data frame

Description

Re-orders data frame rows so that a column is sorted.

Usage

## S3 method for class 'data.frame'
sort(x, decreasing = FALSE, f = ncol(x), ...)

Arguments

x

a data frame

f

the name or number of a column of x, or a numeric vector to play the role of a column of x. Default: Last column.

Value

A reordered version of x where the values in column f are in ascending order.

Author(s)

Tom Minka

See Also

sort_cells

Examples

data(mtcars)
sort(mtcars, f = "mpg")

paulemms/datamining documentation built on March 1, 2023, 4:01 p.m.