Brand new to R here. I'm currently trying to figure out how many patients have heart failure (HF) and diabetes (DM). I've figured out how many people have one or the other but now I need to figure out how to find the comorbidity. Is there a way to create a numerical value for for DM only (1), HFpEF only (2), and DM+HFpEF(3) and neither (0)
Here is the code I've done to find the incidence of the two individually. 0 1 and 2 refer to treatment groups. Since I already have the variables defined, can I add them together to get DM+HFpEF?
DM_HFpEF_together$hfpef_1 <- ifelse (DM_HFpEF_together$ea_2> 1.5, 1, 0)
table(DM_HFpEF_together$hfpef_1 [DM_HFpEF_together$grp == 0])
table(DM_HFpEF_together$hfpef_1 [DM_HFpEF_together$grp == 1])
table(DM_HFpEF_together$hfpef_1 [DM_HFpEF_together$grp == 2])
DM_HFpEF_together$dmstatus_1 <- ifelse (DM_HFpEF_together$dmstatus_1 == 'Y', 1, 0)
table(DM_HFpEF_together$dmstatus_1 [DM_HFpEF_together$grp == 0])
table(DM_HFpEF_together$dmstatus_1 [DM_HFpEF_together$grp == 1])
table(DM_HFpEF_together$dmstatus_1 [DM_HFpEF_together$grp == 2])