knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
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
- The Times New Roman police is used by default (can be changed if necessary)
Those are standards that are frequently used in 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(dplyr) library(reshape2) library(nlme) library(emmeans) library(car)
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 # 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
By default, this table respect all the standards described above.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.