title: using R to plot the mean line of multiple lines
body: <p>I would like to know how to use R to plot the mean line from several individual lines as shown in this figure and obtain the value of both ends from each local segment of the mean line.</p>
  
  <p><img src="https://i.stack.imgur.com/8OAeA.jpg" alt="">
  In the sub-figure on chr 1, 
  solid gray lines: each recombination rate 
  Solid red line: Mean local recombination rate</p>
  
  <p>For instance, how could I plot the mean line for these two files 
  ( 1th column as x axis: position; 2nd column as y axis)</p>
  
  <p>individual 1:</p>
  
  <pre><code>27343,0.014909
  271377,0.044878
  1166716,0.005004
  1384732,0.018162
  1917139,0.006432
  2229415,0.011650
  2736279,0.008127
  3162852,0.019351
  3619476,0.014546
  4233682,0.005321
  </code></pre>
  
  <p>individual 2:</p>
  
  <pre><code>27343,0.045651
  778236,0.032515
  1166716,0.012292
  1603469,0.026068
  2287470,0.011058
  2904105,0.019674
  3619476,0.012513
  4448082,0.012442
  5010563,0.009084
  5535964,0.008281
  </code></pre>
  
  <p>Thank you for your suggestion.</p>