ClinReport enables to export tables an graphics of statistics according to the following standards:
- Display the statistics by (treatment) groups in columns
- Do not display horizontal or vertical lines in the body of the table
- Split vertically the results of several factor levels with empty rows
- Add the number of subjects/observations in the column headers
- Each table is numbered (or can be numbered at least)
- Each table have a title (or can be titled at least)
- The number of digits are the same in all cells of the table
- Police Headers are bolded
- Use the Times New Roman police by default (can be changed if necessary)
Those are usually used for any scientific publications, including the reporting of epidemiological or clinical statistics.
For quantitative statistics:
- Report systematically the standard deviation between parenthesis after the mean: mean(SD)
- Report the interval Q1 Q3 between brackets: [Q1;Q3]
- Report the interval Min Max between brackets: [Min;Max]
For qualitative statistics:
- Report the percentages and the number of observations N(%) or %(N)
For Least-Square Means statistics and P-values:
- Report systematically the standard error between parenthesis after the estimate estimate(SE)
- Report the 95% confidence interval between brackets: [Lower Bound;Upper Bound]
- If P<0.001, display P<0.001 instead of the value of P
ClinReport
The purpose of the package ClinReport is to simplify the Statistical Reporting given the above standards.
They are the default options so few lines of code are necessary.
Example:
library(ClinReport)
library(officer)
library(flextable)
data(datafake)
# Default quantitative stat desc
tab1=report.quanti(data=datafake,y="y_numeric",
x1="GROUP",y.label="Quantitative response (units)",
subjid="SUBJID",total=T)
# Default qualitative stat desc
tab2=report.quali(data=datafake,y="y_logistic",
x1="GROUP",y.label="Qualitative response",
subjid="SUBJID",total=T)
# Binding them into a single table
tab=regroup(tab1,tab2)
# In the R console, it looks like
tab
#>
#> ############################################
#>
#> ############################################
#>
#> Response Levels Statistics A (N=30)
#> 1 Quantitative response (units) N 180
#> 2 Quantitative response (units) Mean (SD) 1.46(1.50)
#> 3 Quantitative response (units) Median 1.59
#> 4 Quantitative response (units) [Q1;Q3] [0.45;2.50]
#> 5 Quantitative response (units) [Min;Max] [-2.34;4.36]
#> 6 Quantitative response (units) Missing 4
#> 7
#> 8 Qualitative response 0 n (column %) 79(43.89%)
#> 9 Qualitative response 1 n (column %) 97(53.89%)
#> 10 Qualitative response Missing n(%) 4(2.22%)
#> B (N=21) C (N=17) Total (N=68)
#> 1 120 96 396
#> 2 3.15(2.00) 3.87(2.52) 2.56(2.20)
#> 3 3.75 4.73 2.71
#> 4 [2.46;4.44] [3.44;5.30] [1.04;4.33]
#> 5 [-2.44;6.19] [-2.99;7.96] [-2.99;7.96]
#> 6 4 2 10
#> 7
#> 8 60(50.00%) 47(48.96%) 186(46.97%)
#> 9 59(49.17%) 44(45.83%) 200(50.51%)
#> 10 1(0.83%) 5(5.21%) 10(2.53%)
#>
#> ############################################
# Create formatted output for Microsoft Word or R markdown documents (like this one)
doc=report.doc(tab,title="Table of classic descriptive statistics (qualitative and quantitative parameter)",
colspan.value="Treatment group", init.numbering =T )
doc
Table 1: Table of classic descriptive statistics (qualitative and quantitative parameter) | ||||||
Treatment group | ||||||
Response | Levels | Statistics | A (N=30) | B (N=21) | C (N=17) | Total (N=68) |
Quantitative response (units) | N | 180 | 120 | 96 | 396 | |
Mean (SD) | 1.46(1.50) | 3.15(2.00) | 3.87(2.52) | 2.56(2.20) | ||
Median | 1.59 | 3.75 | 4.73 | 2.71 | ||
[Q1;Q3] | [0.45;2.50] | [2.46;4.44] | [3.44;5.30] | [1.04;4.33] | ||
[Min;Max] | [-2.34;4.36] | [-2.44;6.19] | [-2.99;7.96] | [-2.99;7.96] | ||
Missing | 4 | 4 | 2 | 10 | ||
Qualitative response | 0 | n (column %) | 79(43.89%) | 60(50.00%) | 47(48.96%) | 186(46.97%) |
1 | n (column %) | 97(53.89%) | 59(49.17%) | 44(45.83%) | 200(50.51%) | |
Missing n(%) | 4(2.22%) | 1(0.83%) | 5(5.21%) | 10(2.53%) | ||
By default, this table respect all the standards described above.