title: Subtract min for every column by group - Add Subtracted Values to another column in df
body: <p>I have a dataframe below: </p>
  
  <pre><code>date    group    col1    col2    col3     col4     col5      
  1234        1      -2       3       4       -5      100       
  1235        1       4       5      -2       -7      200       
  1234        1      -5       2       9        1      400       
  1235        1       8       2      -4        7      900       
  1235        2     -72      83     -54       98      800      
  1233        2      32     -21      -1        4      900      
  1342        2     -54       0     -10      -11      100      
  1234        2      98      -8      -9      -10      100      
  </code></pre>
  
  <p>Here is what I want to do: </p>
  
  <p>For columns df[,3] to the 2nd to last column, I want to do the following: </p>
  
  <p>1) For each column take the minimum value for positive numbers and the minimum number for negative numbers by group. </p>
  
  <p>2) Then replace the current values using this logic: </p>
  
  <p>a) If the value is positive, subtract the minimum value found for the positive numbers by group. </p>
  
  <p>b) If the value is negative, subtract the minimum value found for the negative numbers by group. </p>
  
  <p>c) If the value is 0, make no change</p>
  
  <p>3) Then take the total values that were subtracted for each value in that row and add it to the last column value. </p>
  
  <pre><code>Minimum for col1 neg, group 1 = -5
  Minimum for col1 pos, group 1 = 4
  Minimum for col1 neg, group 2 = -72
  Minimum for col1 pos, group 2 = 32
  Minimum for col2 neg, group 1 = NA
  Minimum for col2 pos, group 1 = 2
  etc.  
  </code></pre>
  
  <p>I want my final output to look like this: </p>
  
  <pre><code>date    group         col1      col2      col3          col4            col5      
  1234        1      -2-(-5)       3-2       4-4       -5-(-7)            100+(-5)+2+4+(-7)       
  1235        1         4-4        5-2   -2-(-4)       -7-(-7)            200+4+2+(-4)+(-7)      
  1234        1      -5-(-5)       2-2       9-4           1-1               400+(-5)+2+4+1       
  1235        1         8-4        2-2   -4-(-4)           7-1               900+4+2+(-4)+1       
  1235        2    -72-(-72)     83-83 -54-(-54)          98-4         800+(-72)+83+(-54)+4      
  1233        2       32-32  -21-(-21)  -1-(-54)           4-4         900+32+(-21)+(-54)+4      
  1342        2    -54-(-72)       0-0 -10-(-54)     -11-(-11)      100+(-72)+0+(-54)+(-11)      
  1234        2       98-32   -8-(-21)  -9-(-54)     -10-(-11)     100+32+(-21)+(-54)+(-11) 
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>date    group         col1      col2      col3          col4            col5      
  1234        1            3         1         0             2              94       
  1235        1            0         3         2             0             195      
  1234        1            0         0         5             0             402       
  1235        1            4         0         0             6             903       
  1235        2            0         0         0            94             761      
  1233        2            0         0        53             0             861      
  1342        2           18         0        44             0             -37      
  1234        2           66        13        45             1              46
  </code></pre>