I would like to include weighted and unweighted n/N, and their respective proportions in a gtsummary table . According the help of gtsummary, both p and unweighted p will be formatted as percentage
See <https://www.danieldsjoberg.com/gtsummary/reference/tbl_svysummary.html>
, but I was unable to obtain the "p unweighted" formatted as percentage.
This is the reprex using data from Academic Performance Dataset from survey package.
require(survey)
data(api)
dstrat <- svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc
,variables = apistrat[,c('pcttest','growth','awards')])
dstrat <- svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc ,variables = apistrat[,c('pcttest','growth','awards')])
gtsummary::tbl_svysummary(data=dstrat ,type=list(pcttest~'continuous',growth~'continuous',awards~'categorical') ,statistic = list( all_continuous()~c("{mean} ({sd})")
,all_categorical()~c("{n}/{N} ({p}%) ; {n_unweighted}/{N_unweighted} ({p_unweighted}%)")
)
)
This is the table output.
gtsummary table output Am I missing something?
Thank you.
R version 4.1.2 (2021-11-01)
packageVersion('survey') [1] ‘4.1.1’
packageVersion('gtsummary') [1] ‘1.5.2’