Skip to content
Back to formatted view

Raw Message

Message-ID: <9C0D67C5-A24D-4051-A5B0-51AD73AE1B44@comcast.net>
Date: 2012-08-30T14:55:37Z
From: David Winsemius
Subject: use row and col names of a matrix to create colnames of a new one.
In-Reply-To: <1346336673419-4641829.post@n4.nabble.com>

On Aug 30, 2012, at 7:24 AM, Juan Antonio Balbuena wrote:

>> matrix1 <- matrix(rnorm(16),4)
>> rownames(matrix1) <- LETTERS[1:4] # fixed the coding error
>> colnames(matrix1) <- letters[1:4]

  matrix2 <- matrix1
  colnames(matrix2) <-  
paste(rownames(matrix1),colnames(matrix1),sep="-")
  matrix2

-- 
David Winsemius, MD
Alameda, CA, USA