I have been trying to make batch univariate cox analysis with apply family and for loops, but I can't edit useful and effective codes. Please, please help me!
I have prepared two kinds of data. Data A, "data_train_list" is a list comprising many data frames. And each column elements in every data frame will serve as independent variables in my codes. Data B, "os_train_list" also is a list including data with data frames. And each data frame in this list will serve as the response variable.
Here are my codes,
for (i in 1:length(data_train_list)) {comb_resBM[[i]]=apply(data_train_list[[i]],2,FUN = function(x){
coxph(Surv(os_train_list[[i]]$time,os_train_list[[i]]$status)~.,data = data_train_list[[i]] )
})}
I hope finally codes can analyze correctly and effectively, because the data in the analysis is huge actually.
Thanks in advance!