Displaying 1 result from an estimated 1 matches for "myintersect".
2012 Jun 06
3
problem about set operation and computation after split
...800
I want to get intersection of product between every year. I know the
basic is:
intersect(intersect(mySplit[[1]]$product,
mySplit[[2]]$product),mySplit[[3]]$product)
this will give the correct answer:
[1] 1 2
above code lacks reusability, so It should use a for loop:
myIntersect<-mySplit[[1]]$product
for (i in 1:length(mySplit)-1){
myIntersect<-intersect(myIntersect,mySplit[[i+1]]$product)
}
It's correct too, but stll too complex, so my question is:
Can I do the same thing just use another similar intersect function
(without for/repeat/wh...