Sets row or column names on a matrix or data frame and returns the modified object.
Usage
setRowNames(x, names)
setColNames(x, names)
Arguments
- x
[matrix | data.frame]
Matrix or data.frame.
- names
[character]
New names for rows / columns.
Examples
setColNames(matrix(1:4, 2, 2), c("a", "b"))
#> a b
#> [1,] 1 3
#> [2,] 2 4