I have a dataframe with several rows and column and I want to check for each row if the row values are higher than the value in the last column of the row. My data looks as follows:
date ABI.BR NOVN.S ROG.S NESN.S NOVOb.CO HRMS.PA TTEF.PA OREP.PA SASY.PA LVMH.PA MAX
1 31.12.2001 7342987743 21072681660 19737660401 57324018814 3199830778 1226900000 105895000000 13740400000 6.4880e+09 1.2229e+10 163033294916
2 31.12.2002 6280730128 17748921146 20316428627 61501808862 3350848339 1242300000 92108991318 14288000000 7.4480e+09 1.2693e+10 144604417185
3 31.12.2003 6324404232 19755193920 20002601887 56367998444 3510991763 1230000000 93961037997 14029100000 8.0480e+09 1.1962e+10 122995279989
4 31.12.2004 7850834622 20947725570 19134043533 54889985325 3905732023 1331400000 87346032957 13641300000 1.5733e+10 1.2481e+10 123515812436
5 31.12.2005 12233279545 26451714210 22833829836 58587603997 4527870421 1427400000 122854000000 14532500000 2.8513e+10 1.3910e+10 171566971202
6 31.12.2006 12660668341 26602920050 26148301223 61238063838 5198638861 1514900000 126235000000 15790100000 2.9489e+10 1.5306e+10 173975809100
My aim is now to check if the values in each row of the columns 2:10 are higher than the corresponding value in column 11 (i.e. MAX). If in a row a value from a column is higher than the value in the MAX column I want to overright the actual value in the column with the value from the MAX column.
For example if I have the following data:
a b c MAX
2 3 4 3
4 5 6 6
6 7 9 8
I would like to have in the corrected data the following output
a b c MAX
2 3 **3** 3
4 5 6 6
6 7 **8** 8
Thank you very much for your help!