title: R - Calculate distance between two points along a polyline
body: <p>In R - I have imported a polyline shapefile that is not straight (represents a winding interstate highway) into the environment.  I have read a .csv file that contains points (latitude/longitude in decimal degrees) into the environment.  All of those points lie along the polyline.  </p>
  
  <p>If I take two random points I can calculate the "as the crow flies" distance between them using great circle distance calculation.  But what is needed is distance traveled along the polyline. See reference image: </p>
  
  <p><a href="https://i.stack.imgur.com/zhorb.png" rel="nofollow noreferrer">https://i.stack.imgur.com/zhorb.png</a></p>
  
  <p>Is anyone aware of an R package that can calculate the distance between two lat/lon points along a polyline?</p>