I have no idea what the hell is going on. Below is my problem in code. I'm writing a function that inverts a matrix and then calls for the entries of the inverted matrix for the below boolean comparison, and for some reason the comparison fails when calling the matrix entry directly but works when using the equivalent integer. The code below replicates my problem.
x<-matrix(c(1,2,3,4),nrow=2,byrow=T)
x
[,1] [,2]
[1,] 1 2
[2,] 3 4
x[1,1]==round(x[1,1])
[1] TRUE
y<-solve(x)
y
[,1] [,2]
[1,] -2.0 1.0
[2,] 1.5 -0.5
y[1,1]==round(y[1,1])
[1] FALSE
y[1,1]
[1] -2
-2==round(-2)
[1] TRUE
wtffffff as you can see in the code, the boolean works with the original matrix (indicating that the structure of the matrix isnt interfering with the comparison), the boolean works with the number -2 (indicating that the boolean works with the value stored in the second matrix), but the boolean fails when calling that value from the second matrix directly (indicating that there's something going on during the matrix inversion problem that taints the matrix and prevents the boolean from working).
I'm not new to R, but I'm no Hadley Wickham either, and this has me completely and utterly stumped. Thank you in advance for your help.