naming rows and columns in a matrix
?rownames ?colnames
x <- matrix(nrow=7, ncol=3)
rownames(x) <- paste('name', 1:7)
rownames(x)
[1] "name 1" "name 2" "name 3" "name 4" "name 5" "name 6" "name 7"
On Sun, Dec 28, 2008 at 12:43 PM, Math Girl <mathmathgurl at yahoo.com> wrote:
Hello,
I have a 3 x 7 matrix. I want to assign a name to each row
and each column. I tried using
dimnames, but for some reason I cannot retrieve the names of the rows or the names
of the columns. Is there another way to name the rows and columns and refer to them?
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.
Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?