title: Create a column based on different group conditions
body: <p>I have a dataset with different columns. Looks like that</p>
  <pre><code>df &lt;- data.frame(PatientID = c(&quot;0002&quot; ,&quot;0004&quot;, &quot;0005&quot;, &quot;0006&quot; ,&quot;0009&quot; ,&quot;0010&quot; ,&quot;0018&quot;, &quot;0019&quot; ,&quot;0020&quot; ,&quot;0027&quot;, &quot;0039&quot; ,&quot;0041&quot; ,&quot;0042&quot;, &quot;0043&quot; ,&quot;0044&quot; ,&quot;0045&quot;, &quot;0046&quot;, &quot;0047&quot; ,&quot;0048&quot; ,&quot;0049&quot;, &quot;0055&quot;),
                   A = c(987.805 , 977.146 , 790.809 , 964.315 ,1014.020 , 952.311 , 992.967 , 950.797 , 958.975  ,960.712  ,958.117 , 947.465 , 902.852 , 961.417,  985.124  ,994.178 , 930.141 ,1007.790 , 948.848, 1027.110 , 999.414),
                   B = c(998.988 , 972.606 , 998.680 , 955.037 , 972.941 ,1020.560 , 947.751 ,1029.560 , 955.540 , 911.606 , 964.039   ,    NA,  988.087 , 902.367 , 959.338 ,1029.050 , 925.162 , 987.374 ,1066.400  ,957.512 , 917.597),
                   C = c( 975.634 , 987.140 , 961.810 , 929.466 , 978.166, 1005.820  ,925.752 , 969.469 , 943.398  ,936.034,  965.292 , 996.404 , 920.610 , 967.047  ,986.565 , 913.517 , 893.428 , 921.606 , 976.192 , 929.590  ,950.493), 
  D = c(975.634 , 987.140 , 961.810 , 929.466 , 978.166, 1005.820 , 925.752 , 969.469  ,943.398 , 936.034 , 965.292 , 996.404 , 920.610 , 967.047 , 986.565 , 913.517 , 893.428 , 921.606 , 976.192 , 929.590 , 950.493),
  E = c(1006.330, 1028.070 , 975.554 , 954.274 ,1005.910  ,949.969 , 992.820 , 977.048  ,934.407 , 948.913 , 944.578 , 917.564 , 975.301,  961.375  ,955.296 , 961.128  ,998.119 ,1009.110 , 994.891 ,1000.170  ,982.763),
  G= c(951.684 , 958.990 , 944.432 , 944.654 , 924.680 , 955.927 , 972.674 , 949.384  ,973.348 , 984.392 , 943.894 , 961.468 , 995.368 , 994.997 , 973.175 , 979.454 , 952.605 , 930.744  ,   NA, 1015.150 , 956.507), stringsAsFactors = F)
  </code></pre>
  <p>Basically what I need is to create an extra column that will be called <code>above threshold</code>, That will be <code>TRUE/FALSE</code> based on the following conditions:</p>
  <p>To be <code>TRUE</code>, the patient need to have values above thresholds in any 3 out of the 6 columns (A, B, C, D, E or G), the thresholds are:</p>
  <ul>
  <li>for A and B -&gt; 990</li>
  <li>for C and D -&gt; 1000</li>
  <li>for E and G -&gt; 1005</li>
  </ul>
  <p>otherwise is <code>FALSE</code></p>
  <p>Basically 3 or more columns need to be TRUE for the final column to be TRUE. The output would look like this (above threshold == TRUE are painted in green):</p>
  <p><a href="https://i.stack.imgur.com/OTAja.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OTAja.png" alt="enter image description here" /></a></p>
  <p>How could I set this up? - I hope this is clear, but ask away if is not!</p>
  <p>Many thanks!</p>