I would like to ask how I can select the highest values per each rows within the following columns
ID mean_idx269 mean_idx270 mean_idx271 mean_idx272 mean_idx273 mean_idx274 mean_idx275 ...
1 37 42 44 40 42 35 46
2 50 41 23 64 21 64 21
3 12 42 55 10 22 12 22
My expected output would be:
ID mean_idx269 mean_idx270 mean_idx271 mean_idx272 mean_idx273 mean_idx274 mean_idx275 ... max
1 37 42 44 40 42 35 46 46
2 50 41 23 64 21 64 21 64
3 12 42 55 10 22 12 22 55
There are other columns in the dataframe, named in a different way, but I would need to extract the maximum from those columns starting/containing mean_idx
.
The result should be a dataframe containing the ID
column and the columns containing mean_idx
.
I do not know if max()
function can be used in this case, as I need to select through more columns per each ID.