colnames_to_row: Move the column names of a data frame to a row

View source: R/colnames_to_row.R

colnames_to_rowR Documentation

Move the column names of a data frame to a row

Description

Moving the column names of a data frame to a row is sometimes useful when formatting a table for export. This function does that and the user can specify which row they'd like the column names to be insterted before.

Usage

colnames_to_row(df, row = 1)

Arguments

df

the data frame

row

the row number before which the column names will be inserted, default is (i.e., the names would become the first row of the data frame).

Value

a data frame with column names in tact but added as a row

Examples


colnames_to_row(iris)
colnames_to_row(iris, row = 5)


EstherHerbert/Useful.functions documentation built on Jan. 31, 2025, 10:41 a.m.