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

David Barron david.barron at jesus.ox.ac.uk
Tue Jul 8 18:38:29 CEST 2003


For a matrix m with k columns:

colnames(m) <- paste("X", 1:k, sep="")

David

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of David Andel
Sent: 08 July 2003 17:23
To: R-Project
Subject: [R] how to rename rows/columns of a matrix?


Hi

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

Thanks a lot,
David

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list