[R] Distance matrices Combinations

arun smartpink111 at yahoo.com
Thu Apr 25 22:54:23 CEST 2013


Hi,
Do you want this?

el<- matrix(1:100,ncol=20)
 set.seed(25)
 el1<- matrix(sample(1:100,20,replace=TRUE),ncol=1)
indx<-sort(el1,index.return=TRUE)$ix[1:3]

 list(el[,indx],sort(el1)[1:3])
#[[1]]
 #    [,1] [,2] [,3]
#[1,]   41   21   11
#[2,]   42   22   12
#[3,]   43   23   13
#[4,]   44   24   14
#[5,]   45   25   15
#
#[[2]]
#[1]  7 13 15
A.K.



________________________________
From: eliza botto <eliza_botto at hotmail.com>
To: "smartpink111 at yahoo.com" <smartpink111 at yahoo.com> 
Sent: Thursday, April 25, 2013 4:45 PM
Subject: RE: [R] Distance matrices Combinations




dear arun,
I will see through it thoroughly if you give some 10 mins. Meanwhile can you please tell me that how we can change the following of your codes so that in "el1" we could see the values not the indexes??

thanks,
Elisa

el1<-matrix(o,ncol=1)
indx<-sort(el1,index.return=F)$ix[1:3]
list(el[,indx],indx)



More information about the R-help mailing list