my.coxph = function(x, t, e) # Simple CoxPH with silenced errors. { m = try(coxph(Surv(t,e)~x, data=data.frame(t=t,e=e,x=x)), silent=TRUE) p = NA if (!inherits(m, 'try-error')) { s = summary(m); p = s$coefficients['x', 5] } return (p) } # options(mc.cores=4) pv = mclapply(as.data.frame(X), # the columns will become entries in a list my.coxph, C$t.rfs, C$e.rfs, mc.cores=4)