extended tbl 1

This commit is contained in:
AG Damsbo 2022-12-06 13:37:42 +01:00
parent d6fc414822
commit 71e67f14a3

View File

@ -84,11 +84,11 @@ source("data_format.R")
## ====================================================================
# Step 1: labels
## ====================================================================
lbs<-var.labels[match(colnames(X_tbl_f), names(var.labels))]
ls<-lapply(1:ncol(X_tbl_f),function(x){
as.formula(paste0(names(lbs)[x],"~","\"",lbs[x],"\""))
})
# lbs<-var.labels[match(colnames(X_tbl_f), names(var.labels))]
#
# ls<-lapply(1:ncol(X_tbl_f),function(x){
# as.formula(paste0(names(lbs)[x],"~","\"",lbs[x],"\""))
# })
## ====================================================================
# Step 2: table - edited
@ -124,8 +124,12 @@ ts_q <- X_tbl |>
tbl_summary(missing = "no",
by="pase_0_cut",
value = list(where(is.factor) ~ "2"),
type = list(mrs_0 ~ "categorical"),
statistic = list(all_continuous() ~ "{median} ({p25};{p75}) [{min},{max}]")
type = list(mrs_0 ~ "categorical",
all_continuous() ~ "continuous2"),
statistic = list(all_continuous() ~ c("{N_nonmiss}",
"{median} ({p25}, {p75})",
"{min}, {max}",
"{mean} ({sd})"))
) |>
add_overall() |>
add_n ()