title: How to compute distances along a network in shapefile? in R
body: <p>I have a river network in a shapefile (class: "SpatialLinesDataFrame"), with some points on it (see picture below).</p>
  
  <p>I would like to compute the distances between points, but along the rivers. I have been searching a lot and I am not able to find any function that allows directly that.</p>
  
  <p>The closest thing I have found is the function "networkdistance" in the package "secrlinear", however I don't manage to transform my shapefile into the format required to use the function (a "linearmask" object).</p>
  
  <p>Any help with this would be extremely appreciated.</p>
  
  <p>Thanks in advance,</p>
  
  <p>Tina.</p>
  
  <p><img src="https://i.stack.imgur.com/qT7Po.png" alt="enter image description here"></p>