One way to add the text is to use a list with named elements for the row and column names:
> (M <- matrix(1:9, ncol=3, byrow=TRUE, + dimnames=list(" "=LETTERS[1:3], + "THIS IS AN EXAMPLE\nOF a 3x3 MATRIX"=LETTERS[1:3])) ) THIS IS AN EXAMPLE OF a 3x3 MATRIX A B C A 1 2 3 B 4 5 6 C 7 8 9 Larry Hotchkiss --------------------------------- Original Post ----------------------------- Message: 7 Date: Thu, 14 Jan 2010 11:04:27 +0100 From: <carfer...@alum.us.es> To: r-help@r-project.org Subject: [R] To add text in a matrix Message-ID: <f61eaf1f1d8d7.4b4ef...@us.es> Content-Type: text/plain; charset=us-ascii Dear colleagues, I would need to add text (some rows of information) in a matrix. For example, given this matrix 1 2 3 4 5 6 7 8 9 I would need to add this info: THIS IS AN EXAMPLE OF a 3x3 MATRIX 1 2 3 4 5 6 7 8 9 I have been looking for a function that works similar to "fopen" in matlab, but unfortunately I have not found It in R. Thank you in advance for your help! Carlos Fernandez ______________________________________________ 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.