Skip to contents

This function moves a specified row in a dataframe to a new position.

Usage

move_row(df, row_from, row_to)

Arguments

df

A dataframe containing the data.

row_from

The index of the row to move.

row_to

The new index for the row.

Value

A dataframe with the row moved to the new position.

Examples

if (FALSE) { # \dontrun{
df <- tibble::tibble(
  a = 1:5,
  b = letters[1:5]
)
new_df <- move_row(df, 5, 2)
print(new_df)
} # }