Index of item in matrix
white.denis at epamail.epa.gov writes:
Try these: which.col <- function (mat, x) (which(mat==x)-1) %/% nrow(mat) + 1 which.row <- function (mat, x) (which(mat==x)-1) %% nrow(mat) + 1 Knowing the R community, there may be already functions to do this.
There is. Take another look at ?which.
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907