Add pair lines in R
<p>I have some data measured pair-wise (<em>e.g.</em> 1C, 1M, 2C and 2M), which I have plotted separately (as C and M). However, I would like to add a line between each pair (<em>e.g.</em> a line from point 1 in the C column to point 1 in the M 'column').</p>

<p>A small section of the entire dataset:</p>

<pre><code>PairNumber  Type    M
1   M   0.117133
2   M   0.054298837
3   M   0.039734
4   M   0.069247069
5   M   0.043053957
1   C   0.051086898
2   C   0.075519
3   C   0.065834198
4   C   0.084632915
5   C   0.054254946
</code></pre>

<p>I have generated the below picture using the following tiny R snippet:</p>

<pre><code>boxplot(test$M ~ test$Type)
stripchart(test$M ~ test$Type, vertical = TRUE, method="jitter", add = TRUE, col = 'blue')
</code></pre>

<p><strong>Current plot:</strong>
<a href="https://i.stack.imgur.com/RHp8n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RHp8n.png" alt="enter image description here"></a></p>

<p>I would like to know what command or what function I would need to achieve this (a rough sketch of the desired result, with only some of the lines, is presented below).</p>

<p><strong>Desired plot:</strong>
<a href="https://i.stack.imgur.com/EkYpm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EkYpm.png" alt="enter image description here"></a></p>

<p><strong>Alternatively</strong>, doing this with ggplot is also fine by me, I have the following alternative ggplot code to produce a plot similar to the first one above:</p>

<pre><code>ggplot(,aes(x=test$Type, y=test$M)) + 
  geom_boxplot(outlier.shape=NA) +
  geom_jitter(position=position_jitter(width=.1, height=0))
</code></pre>

<p>I have been trying <code>geom_path</code>, but I have not found the correct syntax to achieve what I want.</p>