rownames

0th

Percentile

Tools for working with row names

Generally, it is best to avoid row names, because they are basically a character column with different semantics to every other column. These functions allow to you detect if a data frame has row names (has_rownames), remove them (remove_rownames), or convert them back-and-forth between an explicit column (rownames_to_column, and column_to_rownames).

Usage
has_rownames(df)

remove_rownames(df)

rownames_to_column(df, var = "rowname")

column_to_rownames(df, var = "rowname")

Arguments
df
A data frame
var
Name of column to use for rownames.
Aliases
  • column_to_rownames
  • has_rownames
  • remove_rownames
  • rownames
  • rownames_to_column
Examples
has_rownames(mtcars)
has_rownames(iris)
has_rownames(remove_rownames(mtcars))

head(rownames_to_column(mtcars))

mtcars_tbl <- rownames_to_column(tbl_df(mtcars))
mtcars_tbl
column_to_rownames(mtcars_tbl)
Documentation reproduced from package tibble, version 1.0, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.