I have a list of patients who have pain, function, and well-being scores before and after surgery. I want to use a criteria to decide if each patient has improved or not improved after surgery.
The criteria is complex, and I want to use the dplyr
package and the case_when function to add an additional column - Improved - with outcomes yes or no based on the criteria.
The criteria is as follows:
The patient is considered improved if:
- The pain or function score has changed by >50% AND the absolute value for either score has changed by >20.
OR
The patient is considered improved if 2/3 criteria are met:
- The pain score changes by >20% AND the absolute value has changed by >10.
- The function score changes by >20% AND the absolute value has changed by >10.
- The wellbeing score changes by >20% AND the absolute value has changed by >10.