Convert Row Names to an Explicit Column
Usage
append_rownames(x, ...)
# S4 method for class 'data.frame'
append_rownames(x, after = 0, remove = TRUE, var = "rownames")Arguments
- x
- A - data.frame.
- ...
- Currently not used. 
- after
- A length-one - numericvector specifying a subscript, after which the row names are to be appended.
- remove
- A - logicalscalar: should the row names be removed?
- var
- A - characterstring giving the name of name of the new column.
Value
A data.frame.
Examples
X <- data.frame(
  x = 1:5,
  y = 6:10,
  z = LETTERS[1:5]
)
## Assign column to row names
(Y <- assign_rownames(X, 3))
#>   x  y
#> A 1  6
#> B 2  7
#> C 3  8
#> D 4  9
#> E 5 10
## Append row names to data.frame
(Z <- append_rownames(Y))
#>   rownames x  y
#> 1        A 1  6
#> 2        B 2  7
#> 3        C 3  8
#> 4        D 4  9
#> 5        E 5 10
