column.2.row.names: Convert a Column to Row Names in a Tibble or DataFrame

View source: R/ReadWriter.R

column.2.row.namesR Documentation

Convert a Column to Row Names in a Tibble or DataFrame

Description

Converts the first column (or a specified column) of a dataframe or tibble into row names. This function differs from tibble::column_to_rownames in that it takes column names or inices and it offers the option to sanitize row names using make.names, provides a warning if there are duplicated values in the row name column

Usage

column.2.row.names(
  tibble,
  rowname_column = 1,
  make_names = FALSE,
  as_df = TRUE,
  warn = TRUE,
  overwrite = TRUE,
  ...
)

Arguments

tibble

A dataframe or tibble without row names. Default: No default value, a dataframe must be provided.

rowname_column

Index of the column to be used as row names. Default: 1.

make_names

Boolean indicating whether to call make.names to sanitize row names. Default: FALSE.

as_df

Boolean indicating whether to convert the input to a dataframe if it's not already one. Default: TRUE.

warn

Warn user if row names pre-exist. Default: TRUE.

overwrite

Overwrite row names if they already exist. Default: TRUE.

...

Pass arguments to make.names()..


vertesy/ReadWriter documentation built on Nov. 24, 2024, 10:40 p.m.