I have a numeric vector, let's call it v, and I want to evaluate the result of XORing all of its values together, i.e. I want to find v[1] XOR v[2] XOR v[3]
...
I have the binary bitwise XOR function bitXor
from the package bitops
. Is there a neat bit of code I can use that acts like a *apply function and does the complete XORing in one go without using an explicit loop? I'm happy with both a solution that works for any suitable binary function, or if there's an implementation of more-than-binary XOR that I've missed.