I would be thankful if you could help me with the following problem. I have a map for US counties and each county has its own characteristic, say, soil conductivity. Then I have coordinates of the source and signal receiver. What I need to do is to measure the distance from my source to the receiver and save the information about the distance and my signal went through for each county. For example, my source is in county A and my receiver is in county B, so I need to save the distance it moves through county A and the distance it moves through county B. Number of counties it goes through might be more than 2. I have built the map and put coordinates of my source and my receiver on it.
library(sf)
library(tmap)
county_map <- st_read("cty_1930_gis.shp")
qtm(county_map, fill = "cndctmn")
tm_shape(county_map) + tm_polygons(alpha = 0.2, legend.show = FALSE) + tm_shape(stations1) + tm_bubbles(col = "red", size=0.02) + tm_basemap(server = c('OpenStreetMap'))
conductivity for counties map
my source and my receiver on the map
What function should I use to calculate the distance my signal moves in each of counties, based on their borders I have on the map?