[R] Renaming names in R matrix
Gundala Viswanath
gundalav at gmail.com
Tue May 15 11:19:29 CEST 2012
I have the following matrix:
> dat
[,1] [,2] [,3] [,4]
foo 0.7574657 0.2104075 0.02922241 0.002705617
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
and given this:
> new_names <- c("k0","k1","k2,"k3","k4","k5");
How can I get this?
[,1] [,2] [,3] [,4]
k0 0.7574657 0.2104075 0.02922241 0.002705617
k1 0.0000000 0.0000000 0.00000000 0.000000000
k2 0.0000000 0.0000000 0.00000000 0.000000000
k3 0.0000000 0.0000000 0.00000000 0.000000000
k4 0.0000000 0.0000000 0.00000000 0.000000000
k5 0.0000000 0.0000000 0.00000000 0.000000000
best,
GV.
More information about the R-help
mailing list