0

I am doing subgroup analysis in my data using 'subgroupAnalysis' package However, the error 'Error in FUN(X[[i]], ...) : Outcome must be provided as 0/1 numeric' appeared

all confounder is factor, PWV_1668 was 1 or 0 How can I fix it?

dat_surv <- dplyr::select(dat,MB_6y_D,MB_6y,PWV_1668,HBR_yesno,Age_60,Sex,HTN,DM,Dyslipidemia,Diagnosis_AMI,BMI_25,Current_smoker,MV_PCI,Potent_P2Y12I)
dat_surv$DV <- dat_surv$MB_6y == 1
fit_cox <- coxph(Surv(MB_6y_D,DV)~PWV_1668,data=dat_surv)

sub_cox <- subgroupAnalysis(fit_cox,dat_surv,treatment="PWV_1668", 
                            subgroups=c("HBR_yesno"))


Error in FUN(X[[i]], ...) : Outcome must be provided as 0/1 numeric
MrFlick
  • 178,638
  • 15
  • 253
  • 268
HYUN
  • 1
  • 1
    Sounds like you'are not passing our outcome values as numeric values. It's unclear because we don't know what your data looks like. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Jul 14 '21 at 21:06

0 Answers0