Pair wise function repeated N times per row
<p>I have a dataframe which contains 8 unique lat long coordinates pairs per row which I wish to plot. How can I pass each pair of lat longs to the addPolygons function within Leaflet to plot the data row by row?</p>

<p>Once at the end of the row the function should 'stop' and then 'start' again on the next row. The reason I would like to 'stop' the function is to prevent a polygon being drawn from the polygon data of row N to row N+1. Currently this is happening to my polygons when I plot them, it is drawing a polygon to the next site which is not desired. </p>

<p>Below is the code I am using to generate these plots courtesy of @HubertL</p>

<pre><code>m &lt;- as.matrix(t(siteCoor), byrow=T)
dim(m) &lt;- c(2,length(m)/2)
map &lt;- leaflet() %&gt;% addTiles() %&gt;%
       addPolygons(lng=m[1,],lat=m[2,])
</code></pre>

<p><a href="https://i.stack.imgur.com/T0oGQ.png" rel="nofollow"><img src="https://i.stack.imgur.com/T0oGQ.png" alt="Polygon"></a></p>

<p>Sample data is below and at the following <a href="https://drive.google.com/file/d/0BzkBEqPfozOOUmpDLTd6Q0N5Tm8/view?usp=sharing" rel="nofollow">link</a> in dput() format </p>

<pre><code>&gt; head(siteCoor, n = 12L)
   Longitude Latitude         1        2         3        4         5        6         7        8         9       10        11       12        13
1  -8.609117 52.69373 -8.609505 52.71620 -8.602948 52.71588 -8.596586 52.71487 -8.590621 52.71319 -8.585241 52.71089 -8.580617 52.70805 -8.576895
2  -8.609117 52.69373 -8.590303 52.67439 -8.596234 52.67268 -8.602573 52.67162 -8.609117 52.67127 -8.615662 52.67162 -8.622000 52.67268 -8.627931
3  -8.609117 52.69373 -8.644000 52.70119 -8.641276 52.70483 -8.637535 52.70811 -8.632894 52.71094 -8.627501 52.71323 -8.621527 52.71490 -8.615159
4  -8.609117 52.69373 -8.609458 52.71350 -8.603688 52.71323 -8.598090 52.71233 -8.592841 52.71085 -8.588107 52.70883 -8.584038 52.70633 -8.580762
5  -8.609117 52.69373 -8.592560 52.67671 -8.597780 52.67520 -8.603358 52.67428 -8.609117 52.67396 -8.614877 52.67428 -8.620454 52.67520 -8.625674
6  -8.609117 52.69373 -8.639813 52.70030 -8.637416 52.70349 -8.634123 52.70639 -8.630040 52.70888 -8.625294 52.71089 -8.620037 52.71236 -8.614434
7  -8.609117 52.69373 -8.609411 52.71081 -8.604429 52.71057 -8.599594 52.70980 -8.595061 52.70852 -8.590973 52.70677 -8.587459 52.70461 -8.584630
8  -8.609117 52.69373 -8.594817 52.67904 -8.599325 52.67773 -8.604143 52.67693 -8.609117 52.67666 -8.614092 52.67693 -8.618909 52.67773 -8.623417
9  -8.609117 52.69373 -8.635627 52.69940 -8.633556 52.70216 -8.630713 52.70466 -8.627186 52.70681 -8.623088 52.70855 -8.618547 52.70982 -8.613709
10 -8.609117 52.69373 -8.611750 52.72064 -8.603143 52.72045 -8.594761 52.71924 -8.586920 52.71708 -8.579916 52.71403 -8.574012 52.71023 -8.569431
11 -8.609117 52.69373 -8.584672 52.67124 -8.592290 52.66879 -8.600542 52.66728 -8.609117 52.66677 -8.617692 52.66728 -8.625944 52.66879 -8.633562
12 -8.609117 52.69373 -8.651647 52.70143 -8.648402 52.70627 -8.643678 52.71064 -8.637652 52.71438 -8.630550 52.71734 -8.622640 52.71941 -8.614220
         14 Longitude Latitude
1  52.70476 -8.609117 52.69373
2  52.67439 -8.609117 52.69373
3  52.71590 -8.609117 52.69373
4  52.70343 -8.609117 52.69373
5  52.67671 -8.609117 52.69373
6  52.71324 -8.609117 52.69373
7  52.70211 -8.609117 52.69373
8  52.67904 -8.609117 52.69373
9  52.71058 -8.609117 52.69373
10 52.70580 -8.609117 52.69373
11 52.67124 -8.609117 52.69373
12 52.72051 -8.609117 52.69373
</code></pre>