rownames: Tools for working with row names

rn_colR Documentation

Tools for working with row names

Description

The enhanced data.frame, including tibble and data.table, do not support row names. To link to some base r facilities, there should be functions to save information in row names. These functions are analogous to rownames_to_column and column_to_rownames in tibble.

Usage

rn_col(.data, var = "rowname")

col_rn(.data, var = "rowname")

Arguments

.data

A data.frame.

var

Name of column to use for rownames.

Value

rn_col returns a data.table, col_rn returns a data frame.

Examples


 mtcars %>% rn_col()
 mtcars %>% rn_col("rn")

 mtcars %>% rn_col() -> new_mtcars

 new_mtcars %>% col_rn() -> old_mtcars
 old_mtcars
 setequal(mtcars,old_mtcars)

tidyfst documentation built on Sept. 16, 2024, 9:06 a.m.