Will something like this work for you: > x <- matrix(1:100,10) > dimnames(x) <- list(letters[1:10], LETTERS[1:10]) > x A B C D E F G H I J a 1 11 21 31 41 51 61 71 81 91 b 2 12 22 32 42 52 62 72 82 92 c 3 13 23 33 43 53 63 73 83 93 d 4 14 24 34 44 54 64 74 84 94 e 5 15 25 35 45 55 65 75 85 95 f 6 16 26 36 46 56 66 76 86 96 g 7 17 27 37 47 57 67 77 87 97 h 8 18 28 38 48 58 68 78 88 98 i 9 19 29 39 49 59 69 79 89 99 j 10 20 30 40 50 60 70 80 90 100 > x[c('c','g','j'), c("B","E","I")] B E I c 13 43 83 g 17 47 87 j 20 50 90 >
On Fri, Dec 4, 2009 at 8:18 AM, Lee William <leeon...@gmail.com> wrote: > Dear All, > I have a correlation matrix say 'M' (4000x4000) for 4000 genes and I want > to > subset it to 'N' (190x190) for 190 genes. > The list of those 190 genes are in variable 't'. So the idea is to read the > names of genes from variable 't' and subset the matrix M accordingly. > Any thoughts are welcome! > > Best > Lee > > [[alternative HTML version deleted]] > > ______________________________________________ > 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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]] ______________________________________________ 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.