assign names to matrix
On Thu, 16 Nov 2000 Pan_Yuming at aam.de wrote:
dear all,
i have a matrix and i dont know how to assign names to this matrix.
given v is 100x5 matrix, and label -> c("A","B","C","D","E")
idealy, names(v) <- label, but it doesnt work for different length
if dimnames(v) <- list(1:nrow(v),label), then names(v) return NULL
any smart ways? thanks in advance.
Lists have names(). Matrices don't have names(). They have dimnames() (or colnames() and rownames()). You want to use dimnames instead. -thomas Thomas Lumley Assistant Professor, Biostatistics University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._