Learn R Programming

berryFunctions (version 1.22.5)

sortDF: sort dataframes by column

Description

sort a data.frame by column - basically just a wrapper for order

Usage

sortDF(df, col, decreasing = TRUE, quiet = FALSE, ...)

Value

data.frame

Arguments

df

Data.frame to be sorted

col

Column (index or (un)quoted name) to be sorted by

decreasing

Logical: should highest value be on top? DEFAULT: TRUE (unlike order!)

quiet

Logical: suppress non-df warning? DEFAULT: FALSE

...

Further arguments passed to order, like eg na.last or method

Author

Berry Boessenkool, berry-b@gmx.de, June 2015

See Also

sort, order, insertRows, addRows

Examples

Run this code
sortDF(USArrests[USArrests$Murder>11,], Assault)
sortDF(USArrests[USArrests$Murder>11,], "Assault") # safer within functions
sortDF(USArrests[USArrests$Murder>11,], 3)

Run the code above in your browser using DataLab