powered by
This function sets new row names for a given data frame or matrix.
setRownames(object, newRownames)
The data frame or matrix with updated row names.
A data frame or matrix.
A character vector specifying the new row names.
# Set new row names for a data frame df <- data.frame(A = c(1, 2, 3), B = c(4, 5, 6)) setRownames(df, c("row1", "row2", "row3"))
Run the code above in your browser using DataLab