2
Staff would like to know how I can make the Euclidean distance squared between the octadimensional vectors of b and those who are not in a in a super matrix like this of the example.
I thought so and it didn’t work. Someone has an idea?
I read the whole base:
a = matrix(rnorm(4177*8), ncol = 8)
just to illustrate I took the first 1000:
b = a[1:1000, ]
The function takes the ones that are equal 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 mistake:
Error in d - b : non-conformable arrays
The error you should receive is not this. Your error message has
C, and its headquarters has a namec. Also, it is not a good idea to use native function names, especially one likec(). You should receive another error, by virtue of the matricescandbare of different sizes.– Molx
Now that you’ve edited, the error already tells you the problem: You want to subtract matrices of different sizes, there’s something wrong with your math, not your code.
– Molx
I’m checking. Very grateful!
– Wagner Jorge