Dear Elisa, Try this: el<- matrix(1:100,ncol=20) ?set.seed(25) ?el1<- matrix(sample(1:100,20,replace=TRUE),ncol=1) In the example you showed, there were no column names.? ?list(el[,sort(el1)[1:3]],sort(el1,index.return=TRUE)$ix[1:3]) #[[1]] ?# ?? [,1] [,2] [,3] #[1,]?? 31?? 61?? 71 #[2,]?? 32?? 62?? 72 #[3,]?? 33?? 63?? 73 #[4,]?? 34?? 64?? 74 #[5,]?? 35?? 65?? 75 # #[[2]] #[1] 9 5 3 A.K.
From: eliza botto <eliza_botto at hotmail.com>
To: "smartpink111 at yahoo.com" <smartpink111 at yahoo.com>
Sent: Thursday, April 25, 2013 9:54 AM
Subject: connecting matrices
To: "smartpink111 at yahoo.com" <smartpink111 at yahoo.com>
Sent: Thursday, April 25, 2013 9:54 AM
Subject: connecting matrices
Dear Arun, [text file contains the exact format] Although the last codes were absolutely correct and worked the way i want them to. I have an additional cover-up question.? Suppose i have a matrix "el"....... here i show you only some part of that matrix so that codes can work faster. >el ? ? ?[,595586] [,595587] [,595588] [,595589] [,595590] [,595591] [,595592] [,595593] [,595594] [,595595] [,595596] [,595597] [,595598] [,595599] [,595600] [,595601] [1,] ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?55 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 [2,] ? ? ? ?59 ? ? ? ?59 ? ? ? ?59 ? ? ? ?59 ? ? ? ?59 ? ? ? ?59 ? ? ? ?60 ? ? ? ?60 ? ? ? ?60 ? ? ? ?61 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 [3,] ? ? ? ?60 ? ? ? ?60 ? ? ? ?60 ? ? ? ?61 ? ? ? ?61 ? ? ? ?62 ? ? ? ?61 ? ? ? ?61 ? ? ? ?62 ? ? ? ?62 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 ? ? ? ?59 [4,] ? ? ? ?61 ? ? ? ?62 ? ? ? ?63 ? ? ? ?62 ? ? ? ?63 ? ? ? ?63 ? ? ? ?62 ? ? ? ?63 ? ? ? ?63 ? ? ? ?63 ? ? ? ?59 ? ? ? ?60 ? ? ? ?61 ? ? ? ?62 ? ? ? ?63 ? ? ? ?60 ? ? ?[,595602] [,595603] [,595604] [,595605] [,595606] [,595607] [,595608] [,595609] [,595610] [,595611] [,595612] [,595613] [,595614] [,595615] [,595616] [,595617] [1,] ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 ? ? ? ?56 [2,] ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?57 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 ? ? ? ?58 [3,] ? ? ? ?59 ? ? ? ?59 ? ? ? ?59 ? ? ? ?60 ? ? ? ?60 ? ? ? ?60 ? ? ? ?61 ? ? ? ?61 ? ? ? ?62 ? ? ? ?59 ? ? ? ?59 ? ? ? ?59 ? ? ? ?59 ? ? ? ?60 ? ? ? ?60 ? ? ? ?60 [4,] ? ? ? ?61 ? ? ? ?62 ? ? ? ?63 ? ? ? ?61 ? ? ? ?62 ? ? ? ?63 ? ? ? ?62 ? ? ? ?63 ? ? ? ?63 ? ? ? ?60 ? ? ? ?61 ? ? ? ?62 ? ? ? ?63 ? ? ? ?61 ? ? ? ?62 ? ? ? ?63 In connection to this matrix, there is another matrix which contains coordination values for each of the column of matrix "el" >el1 [595586,] ? 5.67 ?? [595587,] ? 55.90 ?? [595588,] ? 515 ?? [595589,] ? 755 ?? [595590,] ? 955 ?? [595591,] ? 5.95 ?? [595592,] ? 575 ?? [595593,] ? 505 ?? [595594,] ? 505 ?? [595595,] ? 515 ?? [595596,] ? 5612 ?? [595597,] ? 506 ?? [595598,] ? 576 ?? [595599,] ? 5126 ?? [595600,] ? 5216 ?? [595601,] ? 5666 ?? [595602,] ? 526 ?? [595603,] ? 5.6 ?? [595604,] ? 156 ?? [595605,] ? 4556 ?? [595606,] ? 5556 ?? [595607,] ? 1256 ?? [595608,] ? 1256 ?? [595609,] ? 8756 ?? [595610,] ? 5906 ?? [595611,] ? 789 ?? [595612,] ? 5006 ?? [595613,] ? 1256 ?? [595614,] ? 3356 ?? [595615,] ? 7756 ?? [595616,] ? 4456 ?? [595617,] ? 3356 ?? What i want in the end is a list of two elemens containing the 10 column of "el" which have the lowest values in matrix "el1". More precisely [[1]] [,595603][,595586][595591,] 565555 575959 596062 626163 [[2]] 5.65.675.95 is it possible to carry out such operation?? thanks for your help Elisa? ? ?