row.names
Row Names Attribute

Description

Returns or changes the row.names attribute of a data frame, an array, or a matrix.

Usage

row.names(x)
row.names(x) <- value

Arguments

x any object; usually a data frame.
value a vector with the same length as the number of rows in x. (If value is not a vector of character strings, it is coerced to one.)

Details

The value can be a character vector or anything that can be coerced to a character vector.
Value
returns a character vector containing the row names.
Side Effects
In the assignment form, the row names of x are changed to value.
Differences between Spotfire Enterprise Runtime for R and Open-source R
Unlike Spotfire Enterprise Runtime for R, open-source R has no function rowIds.
See Also
data.frame, rownames.
Examples

# create a data frame, with the row names as default. df <- data.frame(c(1, 2, 3, 4))

row.names(df) # [1] "1" "2" "3" "4"

row.names(df) <- c("a", "b", "c", "d") row.names(df) # [1] "a" "b" "c" "d"

Package base version 6.1.1-7
Package Index