[R] write matrix M including names(dimnames(M))

Steve Jaffe sjaffe at riskspan.com
Fri Jul 31 05:50:18 CEST 2009


I can do this by writing (and reading) the file according to some format of
my own devising, but I'm wondering if there is a built-in way to write and
then restore a matrix with not only the dimnames (which
write.table/read.table can preserve) but also the names(dimnames)?

Example:
> M <- matrix(1:4, 2, 2)
> dimnames(M) <- list(xdim=c("a", "b"), ydim=c("u", "v"))
> M
    ydim
xdim u v
   a 1 3
   b 2 4


-- 
View this message in context: http://www.nabble.com/write-matrix-M-including-names%28dimnames%28M%29%29-tp24750637p24750637.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list