I am trying to compare vector a of objects using Reduce
- all.equal does not work
- == works for numericals but will not be sufficient for objects.
I would prefer a solution that does not use existing packages but R core functions only
Example (Simplified to use numeric vectors instead of objects):
test <- c(1,1,1,1,1)
Reduce("==",test)
[1] TRUE
I do not understand why == works while all.equal does not
Reduce(all.equal,test)
[1] "Modes: character, numeric"
[2] "Lengths: 3, 1"
[3] "target is character, current is numeric"
Final remark:
This is not a duplicate. I am interested in a solution that compares objects not numeric values
Comparison of the elements of a vector of numeric values: See existing solution on stackoverflow Test for equality among all elements of a single numeric vector