Learn R Programming

arkhe (version 1.4.0)

append: Convert Row Names to an Explicit Column

Description

Convert Row Names to an Explicit Column

Usage

append_rownames(x, ...)

# S4 method for data.frame append_rownames(x, after = 0, remove = TRUE, var = "rownames")

Value

A data.frame.

Arguments

x

A data.frame.

...

Currently not used.

after

A length-one numeric vector specifying a subscript, after which the row names are to be appended.

remove

A logical scalar: should the row names be removed?

var

A character string giving the name of column to use for row names.

Author

N. Frerebeau

See Also

Other transformation tools: assign()

Examples

Run this code
X <- data.frame(
  x = 1:5,
  y = 6:10,
  z = LETTERS[1:5]
)

## Assign column to row names
(Y <- assign_rownames(X, 3))

## Append row names to data.frame
(Z <- append_rownames(Y))

Run the code above in your browser using DataLab