What is compareGroups?

The compareGroups project consists on creating, developing and mantaing a tool written in R meant to build nice format tables with descriptives of several variables from a sample, possibly stratifying by groups.

See examples


What is compareGroups for?

Among other features compareGroups

  • creates data summaries for quality control, extensive reports for exploring data, as well as publication-ready univariate or bivariate tables in several formats (plain text, HTML, LaTeX, PDF, Word or Excel).

  • performs figures to quickly visualise the distribution of your data (boxplots, barplots, normality-plots, etc.).

  • display statistics (mean, median, frequencies, incidences, etc.) depending on the type of variable (continuous, normal-distributed, categorical, etc.).

  • computes the appropriate tests (t-test, Analysis of variance, Kruskal-Wallis, Fisher, log-rank, …) depending on the nature of the described variable (normal, non-normal or qualitative).

  • summarizes genetic data (Single Nucleotids Polymorphisms) data displaying Allele Frequencies and performing Hardy-Weinberg Equilibrium tests among other typical statistics and tests for these kind of data.


How can I use compareGroups?

library(compareGroups)
data(predimed)
res <- compareGroups(group ~ . , predimed)
createTable(res, hide.no="no")

--------Summary descriptives table by 'Intervention group'---------

___________________________________________________________________________________ 
                                  Control    MedDiet + Nuts MedDiet + VOO p.overall 
                                   N=2042        N=2100        N=2182               
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 
Sex:                                                                       <0.001   
    Male                        812 (39.8%)   968 (46.1%)    899 (41.2%)            
    Female                      1230 (60.2%)  1132 (53.9%)  1283 (58.8%)            
Age                             67.3 (6.28)   66.7 (6.02)    67.0 (6.21)    0.003   
Smoking:                                                                    0.444   
    Never                       1282 (62.8%)  1259 (60.0%)  1351 (61.9%)            
    Current                     270 (13.2%)   296 (14.1%)    292 (13.4%)            
    Former                      490 (24.0%)   545 (26.0%)    539 (24.7%)            
Body mass index                 30.3 (3.96)   29.7 (3.77)    29.9 (3.71)   <0.001   
Waist circumference              101 (10.8)    100 (10.6)    100 (10.4)     0.045   
Waist-to-height ratio           0.63 (0.07)   0.62 (0.06)    0.63 (0.06)   <0.001   
Hypertension                    1711 (83.8%)  1738 (82.8%)  1786 (81.9%)    0.249   
Type-2 diabetes                 970 (47.5%)   950 (45.2%)   1082 (49.6%)    0.017   
Dyslipidemia                    1479 (72.4%)  1539 (73.3%)  1560 (71.5%)    0.423   
Family history of premature CHD 462 (22.6%)   460 (21.9%)    507 (23.2%)    0.581   
Hormone-replacement therapy      31 (1.68%)    30 (1.61%)    36 (1.84%)     0.850   
MeDiet Adherence score          8.44 (1.94)   8.81 (1.90)    8.77 (1.97)   <0.001   
follow-up to main event (years) 4.09 (1.74)   4.31 (1.70)    4.64 (1.60)   <0.001   
AMI, stroke, or CV Death         97 (4.75%)    70 (3.33%)    85 (3.90%)     0.064   
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 


Why compareGroups?

Althought there are several functions in R to build descriptives (see…), it does not exist any to create tables in the standard format as are presented in many epidemiology studies (see figures). So we…

@@ To be completed @@


Who is behind compareGroups?

compareGroups is developed and maintained by Isaac Subirana, Joan Vila, Héctor Sanz at the Cardiovascular Epidemiology Research Unit (URLEC), located at Barcelona Biomedical Research Park, and collaborators (Gavin Lucas, Judith Peñafiel and David Giménez).

As the driving force behind the REGICOR study, URLEC has extensive experience in statistical epidemiology, and is a national reference centre for research into cardiovascular diseases and their risk factors.