title: Swapping the values in columns with the condition of another column in R
body: <p>For the following data, if  the <code>p.2</code> values is greater than 0.5, I would like to swap the values of column-1<code>(b.1.1)</code> and column-2 <code>b.1.2</code>, 
  column-3<code>(b.2.1)</code> and column-4 <code>b.2.2</code> , column-5<code>(b.3.1)</code> and column-6 <code>b.3.2</code> </p>
  
  <pre><code> mydata
              b.1.1       b.1.2      b.2.1      b.2.2     b.3.1      b.3.2        p.1       p.2
      1  0.40772028  0.43064446  0.2697412  0.9191535 0.1523922  0.7629324 0.86061981 0.1393802
      2 -0.77459375  0.79860856 -0.5263932 -0.5640303 0.5131236  0.6472614 0.63494425 0.3650557
      3 -0.06088828  0.42685669 -1.0643744  0.8330836 0.1184059  0.6661079 0.07382585 0.9261742
      4  1.54204242 -0.08987067 -0.7365012  0.3762336 0.3781115 -0.7340340 0.65481949 0.3451805
      5 -0.73397310  1.34927693  0.2202689  0.2422944 1.5267535 -0.5207967 0.54425551 0.4557445
  </code></pre>
  
  <p>For example, in the first row,  between <code>p.1</code> and <code>p.2</code>,   <code>p.2</code> is not greater than 0.5, I am not swapping any values of this row. In the third row, <code>p.2</code> is greater than 0.5, So, I would like to swap the row values of each beta pair written above.
  Any help is appreciated.</p>