People would like to know how I can make the squared Euclidean distance between the octadimensional vectors of b
and those that are not in a
in a super matrix like this one in the example.
I thought so and it did not work. Anyone have an idea?
I read the entire base:
a = matrix(rnorm(4177*8), ncol = 8)
Just to give an example, I picked up the first 1000:
b = a[1:1000, ]
The function takes the ones that are the same and leaves the different ones:
d = a[!apply(a, 1, function(arow) any(apply(b, 1, function(brow) all(brow==arow)))),]
distancia = t(d - b)%*%(d - b)
But I have the following error:
Error in d - b: non - conformable arrays