R version : 2.4.0
O/S: Windows XP SP2 :-(

How does one assign names to the columns of a matrix so that the columns 
can be accesses using the '$' operator? It seem that x$c1 below should 
return column 1.

 > x = matrix(1:4,2)
 > dimnames(x) = list(c("r1", "r2"), c("c1", "c2"))
 > x
    c1 c2
r1  1  3
r2  2  4
 > x$c1
NULL
 > x$c2
NULL

Daniel Gatti
UNC-CH

______________________________________________
[email protected] 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.

Reply via email to