order_df: Order a dataframe by a given column

Description Usage Arguments Value Examples

View source: R/utilities.R

Description

A simple wrapper round the base R order function allowing chaining with %>%

Usage

1
order_df(df, x, decreasing = FALSE)

Arguments

df

the dataframe to order

x

the column to order by

decreasing

logical. Is the order increasing or decreasing?

Value

An ordered dataframe

Examples

1
2
3
4
5
order_df(mtcars, ~ cyl)

# Same operation can be done with the pipe operator

mtcars %>% order_df(~ cyl)

AndBooth/Rutils documentation built on May 28, 2019, 11:04 a.m.