Suppose that I have five vectors:
A<-1:10
B<-1:10
C<-1:10
D<-1:10
E<-1:12
I could test two at a time using identical( ).
I would just pick one, say A
, and do all pair-wise comparisons with it.
all(sapply(list(B, C, D, E), FUN = identical, A))
# [1] FALSE
Remove the all()
to see the not identical one(s)
sapply(list(B, C, D, E), FUN = identical, A)
# [1] TRUE TRUE TRUE FALSE
identical
ought to be transitive, so if A
is identical to C
and to D
, then C
should be identical to D
.
(Thanks to @docendo discimus for simplified syntax.)