isubirana / compareGroups

R package to easily build publication-ready univariate or bivariate descriptive tables from a data set.
https://isubirana.github.io/compareGroups/
33 stars 14 forks source link

N and confidence intervals #34

Open mcewenrk opened 1 year ago

mcewenrk commented 1 year ago

Hello, Many thanks for a very useful and helpful package. I was wondering whether there was any way to include confidence intervals in addition to the n per group descrTable(year ~ ., data=regicor, show.n = T)

--------Summary descriptives table by 'Recruitment year'---------


                                                   1995              2000           2005     p.overall 
                                                   N=431             N=786         N=1077              

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Sex: 0.506
Male 206 (47.8%) 390 (49.6%) 505 (46.9%)
Female 225 (52.2%) 396 (50.4%) 572 (53.1%)

Including the show.ci flag overrides show.n descrTable(year ~ ., data=regicor, show.ci = T, show.n = T)


                                                            1995                               2000                       2005         p.overall  N   
                                                           N=431                              N=786                      N=1077                       

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Sex: 0.506 2294 Male 47.8% [43.0%;52.6%] 49.6% [46.1%;53.2%] 46.9% [43.9%;49.9%]
Female 52.2% [47.4%;57.0%] 50.4% [46.8%;53.9%] 53.1% [50.1%;56.1%]

I'm interested in seeing the following format e.g. for "Male" and 1995: 206 47.8% [43.0%;52.6%] (n % [CI])

isubirana commented 1 year ago

I appreciate your words and am glad you find the package useful.

Unfortunately, it is not possible to report both, n and percentage with its confidence interval.

Regards,

Isaac.