@@ -183,10 +183,11 @@ coxModule <- function(input, output, session, data, data_label, data_varStruct =
183
183
function (v ){
184
184
if (is.null(id.cluster )){
185
185
forms <- as.formula(paste(" survival::Surv(" , input $ time_cox , " ," , input $ event_cox , " ) ~ " , v , sep = " " ))
186
+ coef <- tryCatch(summary(survival :: coxph(forms , data = data.cox ))$ coefficients , error = function (e ){return (NULL )})
186
187
} else {
187
188
forms <- as.formula(paste(" survival::Surv(" , input $ time_cox , " ," , input $ event_cox , " ) ~ " , v , " + cluster(" , id.cluster(), " )" , sep = " " ))
189
+ coef <- tryCatch(summary(survival :: coxph(forms , data = data.cox , robust = T ))$ coefficients , error = function (e ){return (NULL )})
188
190
}
189
- coef <- tryCatch(summary(survival :: coxph(forms , data = data.cox , robust = T ))$ coefficients , error = function (e ){return (NULL )})
190
191
sigOK <- ifelse(is.null(coef ), F , ! all(coef [, " Pr(>|z|)" ] > 0.05 ))
191
192
return (sigOK )
192
193
})
@@ -324,7 +325,11 @@ coxModule <- function(input, output, session, data, data_label, data_varStruct =
324
325
)
325
326
326
327
if (is.null(design.survey )){
327
- cc <- substitute(survival :: coxph(.form , data = data.cox , model = T , robust = T ), list (.form = form.cox()))
328
+ if (is.null(id.cluster )){
329
+ cc <- substitute(survival :: coxph(.form , data = data.cox , model = T ), list (.form = form.cox()))
330
+ } else {
331
+ cc <- substitute(survival :: coxph(.form , data = data.cox , model = T , robust = T ), list (.form = form.cox()))
332
+ }
328
333
res.cox <- eval(cc )
329
334
tb.cox <- jstable :: cox2.display(res.cox , dec = input $ decimal )
330
335
tb.cox <- jstable :: LabeljsCox(tb.cox , ref = label.regress )
0 commit comments