?'=='
"For numerical and complex values, remember == and != do not allow for the finite representation of fractions, nor for rounding error. Using all.equal with identical is almost always preferable."
The "merge" function is to match one element at a time. That is why you see "7L" as it is the first element in "d1". You can either change the order of "d1" before merging or change the order of "demo" in the end, by using "order" function.
See details by inputing "?order'