r - How to let identical ignore attribute/names? -
> 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 identical
compare not vectors content, names well.
how avoid names check without manually deleting them?
this gives desired result:
> identical( unname(a), unname(b)) [1] true
this gives useful result misleading information:
> mapply("==", ,b) var2 var3 var4 var5 var6 true true true true true
Comments
Post a Comment