[R] how to rename rows/columns of a matrix?

David Khabie-Zeitoune dave at evocapital.com
Tue Jul 8 18:34:53 CEST 2003

If A is your matrix try:

cnames(A) = paste("X", 1:ncol(A), sep="")

-----Original Message-----
From: David Andel [mailto:andel at ifi.unizh.ch] 
Sent: 08 July 2003 17:23
To: R-Project
Subject: [R] how to rename rows/columns of a matrix?


I get a matrix with the columns named like "X13 X22 X1 X14 ...", i.e.
successively. That has it's good reasons, but now how can I rename the 
columns to "X1 X2 X3 ..."?

Thanks a lot,

R-help at stat.math.ethz.ch mailing list

More information about the R-help mailing list