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. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.