The goal of hans is to make a fast dataframe compatible haversine function.
You can install the released version of hans from CRAN with:
install.packages("hans")
This is a basic example which shows you how to solve a common problem:
library(tibble)
library(dplyr)
library(magrittr)
set.seed(42)
<- runif(-160, -60, n = 1e6)
lon1 <- runif(40, 60, n = 1e6)
lat1 <- runif(-160, -60, n = 1e6)
lon2 <- runif(40, 60, n = 1e6)
lat2
<- tibble::tibble(lat1, lon1, lat2, lon2) %>%
df mutate(hav = haversine(lat1, lon1, lat2, lon2))