1

B and C.

A <- 1:5
B <- 3:7
C <- 6:10

now I want to take union of these three vectors. I am doing like this :

uni <- union (A,union(B,C))

But is there any way to do it in loop or something if have more than three vectors of which I need to take the union of ??

4

1 に答える 1

5

これらを alistに結合してから使用しますReduce

Reduce(union, list(A, B, C))
 [1]  1  2  3  4  5  6  7  8  9 10
于 2012-06-04T11:05:09.897 に答える