Learn R Programming

name (version 0.0.2)

relocate_with: Relocate columns

Description

Relocate columns

Usage

relocate_with(
  .data,
  .fn,
  .cols = everything(),
  .before = NULL,
  .after = NULL,
  ...
)

Value

And object with same type as .data.

Arguments

.data

A data.frame or tibble.

.fn

A function to reorder .cols.

.cols

Columns to move

.before, .after

Destination of columns. If both selected, errors. If neither, moves to right of first selected column.

...

additional arguments to pass to .fn

Examples

Run this code
data(sd)
sd |> relocate_with(sort)

Run the code above in your browser using DataLab