I have 188 rows and +1000 columns with variables. 3 of these columns are stating 3 different diagnosis with a logical operator, so 1 for every time the person has the disease of that column. In other columns I have for example age. So it looks like this:
Observations Diagnosis 1 Diagnosis 2 Diagnosis 3 Age
1 0 0 1 45
2 0 1 0 95
...
188 0 1 0 67
I wold like to get the age of only the people with each of the individual diseases. So I need to somehow specify the row of then Diagnosis = 1 and then subtract the column Age, but only for those specific rows.
Can anyone help with this?