##归因危险度
library(survival)
set.seed(123)
total <- nutrDII0[,c("DII","age","sex","Townsend_index","race","BMI","MET","pack_smoking",
"familiy_cancer","assess_centre","education","cancer_all","survival_all")]
total$DIIpar <- ifelse(total$DII<"-1",0,ifelse(total$DII>="-1"&total$DII<=1,1,2))
#创建生存对象
#total$survival_all <- as.numeric(total$survival_all)
#total$cancer_all <- as.factor(total$cancer_all)
surv_obj <- with(total,Surv(survival_all,cancer_all))
#拟合生存模型
fit <- survfit(surv_obj~as.factor(DIIpar)+as.numeric(age) +
as.factor(sex) + as.numeric(Townsend_index) +
as.factor(race) + as.numeric(BMI) + as.numeric(MET) +
as.factor(familiy_cancer) +as.factor(education) +
as.factor(assess_centre)+as.factor(pack_smoking),data=total)
par_estimation <- par(fit)
print(par_estimation)
运行上述代码后出现“[size=13.3333px]Error: cannot allocate vector of size 5569.7 Gb”报错情况,怎么解决啊啊啊啊啊