rawr_rownames: Rowname tools

rawr_rownamesR Documentation

Rowname tools

Description

Convenience functions for working with row names.

rownames_to_column adds a column to an object using its rownames; column_to_rownames adds rownames to an object using a specified column.

Usage

rownames_to_column(data, column = "rownames", where = 1L)

column_to_rownames(data, column = "rownames", where = 1L)

Arguments

data

a matrix or data frame

column

the name of the column to create or the column name used to create the row names; if column is already used, the new name will be passed to make.unique before used

where

the location to add column or the index of the column used to create new row names; for rownames_to_column, the default is to add the new column first; optional for column_to_rownames column will be ignored if where is given

See Also

insert; tibble::rownames

Examples

x <- rownames_to_column(mtcars, where = 5)
identical(mtcars, column_to_rownames(x))
identical(mtcars, column_to_rownames(x, where = 5))

column_to_rownames(as.matrix(mtcars), 'mpg')


raredd/rawr documentation built on Feb. 25, 2025, 1:48 p.m.