RfastOfficial/Rfast

Does haversine distance work properly?

kadyb opened this issue · 3 comments

kadyb commented
library(Rfast)
x <- matrix(rnorm(200), nrow = 100, ncol = 2)
d <- Dist(x, method = "haversine")
d
#>           [,1]      [,2]
#> [1,] 0.0000000 0.7152545
#> [2,] 0.7152545 0.0000000

As a result, I would expect 100 x 100 matrix, but it is 2 x 2.

There is a typo in checking "harvesine" method instead of "haversine". I have fix it and it will be chabged from the next update.
For now you can safely just transpose the given argument.

kadyb commented

Thank you! I have one more question. For haversine distance, could you consider a separate argument for converting from degrees to meters (by multiplying the Earth's radius; r = 6378137 m)? This can be useful for geographers. Of course, if it matters in terms of performance, because we can do it on R side.

Well I first of all sorry. I forgot to answer...
We could do that yes.