Hi,
Suppose I want to create a new variable heart_disease with two levels (0 and 1) from three existing binary variables (heart_failure, angina, MI). The variable heart_disease will be coded as 1 if any of the existing variables have value of 1; else heart_disease = 0. How do I code this? Please see the dataset blurb below.
Thank you so much!
Javaid
Hi @FJCC,
Thank you so much for the help! What if my existing variables are stored as factor variables, each with two levels -- 0 = "No", 1 = "Yes". I am sorry, I should have been more clear.
Thank you!
Please post a small data set as you did above but use the output of the dput() function. If your small data set is called DF, run dput(DF) and paste the output between lines that contain only three back ticks.
```
Paste output here
```