I have 2 datasets with three columns each. One has WarehouseID (primary key), WarehouseLat, and WarehouseLon. The other has StoreID (primary key), StoreLat, and StoreLon. The warehouses ship products to the stores. The goal is to determine which warehouse is closest to each store (by travel time or distance), in theory optimizing the distribution network. Ideally, the R package would not just use linear distances, but it would calculate travel time or distance over actual roads (in the USA).
I've looked at the stplanr package (https://cran.r-project.org/web/packages/stplanr/vignettes/stplanr-paper.html) but I don't believe this optimizes the combinations of 2 different types of entities (warehouses and stores). However, I am very elementary to R and I may be missing this functionality in the various packages I've found online.
The result of the script certainly doesn't have to appear this way, but this is essentially what I am envisioning: the resultant dataset would have 4 columns (StoreID (primary key), WarehouseID (foreign key), Distance, TravelTime). Again, it doesn't have to appear that way, but that would essentially answer the question I am trying to understand.