HI Elisa,
I guess there is a mistake.
Check whether this is what you wanted.
indx<-sort(el1,index.return=TRUE)$ix[1:3]
list(el[,indx],indx)
#[[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] 9 5 3
A.K.
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
Thanks arun,The second one look ok..thanks indeed
Elisa
> Date: Thu, 25 Apr 2013 07:37:25 -0700
> From: smartpink...@yahoo.com
> Subject: Re: connecting matrices
> To: eliza_bo...@hotmail.com
> CC: r-help@r-project.org
>
> HI Elisa,
> I guess there is a mistake.
> Check whether this is what you w
3 matches
Mail list logo