Description Usage Arguments Value References Examples

This funciton uses the Haversine forumula for calculating great circle distances between points. This formula is purpoted to work better than the spherical law of cosines for very short distances.

1 | ```
distance(targetLon, targetLat, longitude, latitude)
``` |

`targetLon` |
longitude (decimal degrees) of the point from which distances are calculated |

`targetLat` |
latitude (decimal degrees) of the point from which distances are calculated |

`longitude` |
vector of longitudes for which a distance is calculated |

`latitude` |
vector of latitudes for which a distance is calculated |

Vector of distances in km.

https://www.r-bloggers.com/great-circle-distance-calculations-in-r/

1 2 3 4 5 6 | ```
# Seattle to Portland airports
SEA_lon <- -122.3088
SEA_lat <- 47.4502
PDX_lon <- -122.5951
PDX_lat <- 45.5898
distance(SEA_lon, SEA_lat, PDX_lon, PDX_lat)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.