We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unit
distance
I have discovered that the argument unit of distance function works well only in certain specific situations.
My data:
df <- data.frame(Lat = c(42.1234, 41.0192, 40.9988, 51.0175, 50.6523, 50.9214), Lon = c(26.5462, 25.9967, 27.0001, 31.1542, 31.8924, 32.1025))
Example 1: Good behavior.
distance(x = as.matrix(df[,c("Lon", "Lat")]), lonlat = TRUE, unit = "m") distance(x = as.matrix(df[,c("Lon", "Lat")]), lonlat = TRUE, unit = "km")
Example 2: Bad behavior.
distance(x = as.matrix(df), y = as.matrix(df), lonlat = TRUE, unit = "m") distance(x = as.matrix(df), y = as.matrix(df), lonlat = TRUE, unit = "km")
I think it requires an urgent patch because it is an invisible issue that could not be noticed.
My platform: OS: Windows 10 RStudio 2024.04.2 Build 764 R 4.4.0 terra 1.7-78
The text was updated successfully, but these errors were encountered:
b170c3c
Thank you. I now get:
distance(x = as.matrix(df), y = as.matrix(df), lonlat = TRUE, unit = "km") # [,1] [,2] [,3] [,4] [,5] [,6] #[1,] 0.0000 125.9805 122.6313 1006.4391 1018.61992 1052.68131 #[2,] 125.9805 0.0000 111.1910 1132.1578 1143.24154 1177.20483 #[3,] 122.6313 111.1910 0.0000 1078.0487 1081.50932 1114.86600 #[4,] 1006.4391 1132.1578 1078.0487 0.0000 88.89660 105.54234 #[5,] 1018.6199 1143.2415 1081.5093 88.8966 0.00000 34.48749 #[6,] 1052.6813 1177.2048 1114.8660 105.5423 34.48749 0.00000
Sorry, something went wrong.
No branches or pull requests
I have discovered that the argument
unit
ofdistance
function works well only in certain specific situations.My data:
Example 1: Good behavior.
Example 2: Bad behavior.
I think it requires an urgent patch because it is an invisible issue that could not be noticed.
My platform:
OS: Windows 10
RStudio 2024.04.2 Build 764
R 4.4.0
terra 1.7-78
The text was updated successfully, but these errors were encountered: