Ha Guillaume,
Is this what you are looking for?
#---
x1<-sample(1:10,5,replace=FALSE)
x2<-sample(1:10,100,replace=TRUE)
#This
tapply(x1,1:5,FUN=function(i){which(x2==i)})
#or this
tapply(x1,x1,FUN=function(i){which(x2==i)})
#---
Gerrit
___
how to combine apply and which or alternative ways to do so
>
> Dear useRs,
>
> I am currently doing some data cleaning and data manipulation and I have
> the
> following problem.
> I have two vectors. Let say the size of the first one is 10 000 (vector
> 1)
> and the s
ubject: [R] how to combine apply and which or alternative ways to do so
Dear useRs,
I am currently doing some data cleaning and data manipulation and I have the
following problem.
I have two vectors. Let say the size of the first one is 10 000 (vector 1)
and the size of the second one is 1 000 000
Dear useRs,
I am currently doing some data cleaning and data manipulation and I have the
following problem.
I have two vectors. Let say the size of the first one is 10 000 (vector 1)
and the size of the second one is 1 000 000 (vector 2).
I need to know for each cell of vector 1 which cells of v
4 matches
Mail list logo