Hello, Try
sapply(seq_len(ncol(mt2)), function(j) mt1[mt2[, j], j]) Hope this helps, Rui Barradas Em 12-06-2012 17:19, Zhenjiang Lan escreveu:
mt1: [,1] [,2] [,3] [1,] "G" "A" "A" [2,] "C" "T" "C" mt2: [,1] [,2] [,3] [1,] 1 2 2 [2,] 2 1 2 [3,] 2 2 2 [4,] 1 1 1
______________________________________________ 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.