Entering edit mode

hi,

i have a correlation matrix like below

> head(mat[,1:4]) AT1G01060 AT1G01170 AT1G01180 AT1G01260 AT1G01060 1.0000000 0.3193360 0.6272994 0.2658624 AT1G01170 0.3193360 1.0000000 0.3178880 0.3588030 AT1G01180 0.6272994 0.3178880 1.0000000 0.2542234 AT1G01260 0.2658624 0.3588030 0.2542234 1.0000000 AT1G01380 0.6178751 0.1561297 0.7052692 0.3252033 AT1G01490 0.5990499 0.6129301 0.6424225 0.5727253 > dim(mat) [1] 3123 3123 i did > mat <- diag(mat = 1, nrow, ncol = 3123) |

how i can get this matrix with diagonal = 1 ??? thank you |

thank you

i did like so but the colnames and rownames of my matrix changed

how i can back the colnames and rownames as already please?

The

`diag`

function will generate an entirely new matrix. If you want the names of the old matrix, you should do:Or perhaps more intuitively:

In both cases, I'm assuming that

`mat`

contains your original correlation matrix.thank you

sorry no problem if the original measures from the first matrix changed in diagonal matrix to only 0 and 1???

changed to

>

actually i need

I don't understand your problem. From what I can see, your original matrix already has diagonals of 1. This is obviously the case, because each gene would be perfectly correlated with itself.

yes you all right..right now i considered my original matrix

many thanks again