> str(a)
Named int [1:5] 0 0 0 0 0
- attr(*, "names")= chr [1:5] "Var2" "Var3" "Var4" "Var5" ...
> str(b)
Named int [1:5] 0 0 0 0 0
- attr(*, "names")= chr [1:5] "Var1" "Var2" "Var3" "Var4" ...
> identical(a,b)
[1] FALSE
I realized that identical compare not only the vectors content, but the names as well.
How to avoid the names check without manually deleting them?
This gives the desired result:
> identical( unname(a), unname(b))
[1] TRUE
This gives a useful result but misleading information:
> mapply("==", a ,b)
Var2 Var3 Var4 Var5 Var6
TRUE TRUE TRUE TRUE TRUE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With