rawr_rownames | R Documentation |
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.
rownames_to_column(data, column = "rownames", where = 1L)
column_to_rownames(data, column = "rownames", where = 1L)
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 |
where |
the location to add |
insert
; tibble::rownames
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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.