Usuario R
2009-May-08 09:56 UTC
[R] Comparing elements of a vector, grouped by values in other vector.
Hi, I have the following vectors: v1 <- rep( LETTERS[ 1:4 ], each = 5) v2 <- c( letters[ 1:10 ], letters[ 1:10 ] ) Notice that:> tapply( B, A, I )$A [1] "a" "b" "c" "d" "e" $B [1] "f" "g" "h" "i" "j" $C [1] "a" "b" "c" "d" "e" $D [1] "f" "g" "h" "i" "j" Here we can see there are two groups of values: *abcde* and *fghij*. This two groups can have elements in different order so: *abcde* is consider in the same group as *ebcda*. I want to obtain the following information: "There are two groups in vector *v2*, corresponding to levels "A" and "C" in vector *v1*" Any idea? Thanks [[alternative HTML version deleted]]