Description Usage Arguments Value Author(s) Examples
View source: R/estimate_distance.R
Estimate the distance in kilometers from one point to a set of points in decimal long-lat coordinates.
1 | estimate_distance(x, y, df.x, df.y)
|
x |
Longitude coordinates in decimal degrees for the reference point. |
y |
Latitude coordinates in decimal degrees for the reference point. |
df.x |
Vector with the longitude coordinates in decimal degrees. Should have the same length as df.y. |
df.y |
Vector with the latitude coordinates in decimal degrees. Should have the same length as df.x. |
A vector of the same length than df.x and df.y, with the distances in kilometers between points.
Ricardo Ochoa Sosa
1 2 3 4 5 6 7 8 9 10 11 12 13 | my.data <-
read.table(header = TRUE, text = "
x y variable
-99.495 19.16 1
-99.490 19.16 5
-99.500 19.14 2
-99.490 19.15 10
")
#
estimate_distance(x = -99.490,
y = 19.16,
df.x = my.data$x,
df.y = my.data$y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.