I have two matrices as given below. When I wanted to check whether these two are identical or not, I get FALSE
results. I do not understand where I am wrong?
I have checked class(A)
and class(B)
, both are matrices.
>A
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 0 0 -1 0 0 -1 -1
[2,] 0 1 0 1 0 0 0 0
[3,] 0 0 1 1 0 0 1 1
[4,] 0 0 0 0 1 0 1 0
[5,] 0 0 0 0 0 1 0 1
>B
1 2 3 4 5 6 7 8
1 1 0 0 -1 0 0 -1 -1
2 0 1 0 1 0 0 0 0
3 0 0 1 1 0 0 1 1
4 0 0 0 0 1 0 1 0
5 0 0 0 0 0 1 0 1
> A ==B
1 2 3 4 5 6 7 8
1 TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE
2 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
3 TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE
4 TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE
5 TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE
>identical(A,B)
[1] FALSE