Re: [R] finding row and column names of a matrix

2010-10-08 Thread Dimitris Rizopoulos
try this: mat <- matrix(rnorm(20), 5, 4, dimnames = list(letters[1:5], LETTERS[1:4])) mat[sample(20, 4)] <- NA ind <- which(is.na(mat), arr.ind = TRUE) mat cbind(RowName = rownames(mat)[ind[, 1]], ColName = colnames(mat)[ind[, 2]]) I hope it helps. Best, Dimitris On 10/8/2010 7:09

[R] finding row and column names of a matrix

2010-10-08 Thread Data Analytics Corp.
Hi, Suppose I have a 3X4 matrix with row names TL, JAR and TM and column names A, B, C, D. The cell in the first row, third column has an NA. I want to find the row and column NAMES corresponding to that cell with the NA. Obviously, I want to extend this to any matrix of any size that has