You can copy the rownames of a matrix to a new column by creating a new column and assigning the rownames to it. Here's how you can do it:
main.r180 chars9 lines
In the code above, we first create a matrix mat
with rownames "row1", "row2", and "row3". Then, we use cbind()
function to add a new column named "row.names" to the matrix with the rownames.
This will copy the rownames to the new column in the matrix.
gistlibby LogSnag