The columns in this matrix are the following: trial_number participant_number gab_ori1 gab_ori2 gab_ori3 gab_ori4 target response
How do I make a function that substracts the response column from the relevant gab_ori column? For example, if the target is 1 then I want to substract the response from gab_ori1. For the last row that would be 158 - 117.47 (of course the actual target in this row is 4, this is just an example). If the target were to be 3, then I want to substract the response from gab_ori3 etc.
I never worked with functions before so if anyone could help me in the right direction that would be greatly appreciated.