tbl1 | R Documentation |
Creates an descriptive table stratified by groups with apropriate tests, if necessary.
tbl1( d, strat = NULL, mrgn = 2, path = NULL, sheetName = NULL, mode = c("auto", "median", "mean"), cat_freq = c("all", "rel", "abs"), exact = c("ifNecessary", "never", "always"), p_values = TRUE, alpha = 0.05, rnd = 3, coloured_excel = TRUE, cont_cor = FALSE ) tbls1( d, strats, path = NULL, mode = c("auto", "median", "mean"), exact = c("ifNecessary", "never", "always"), cat_freq = c("all", "rel", "abs"), p_values = TRUE, coloured_excel = TRUE, mrgn = 2, rnd = 3, alpha = 0.05, cont_cor = FALSE )
d |
Data frame or data table with all variables of interest for table 1 (including the stratification variable). |
strat |
String which represents the name of the stratification variable that should be used in the table 1 (also for more than two levels). In case of overall descriptive statistics use the default (strat=NULL). |
mrgn |
Sets the margin of the proportions for categorical variables (1=rowwise, 2=columnwise (default)). |
path |
Path, where the Excel file should be stored (requires ".xlxs" at the end). If NULL, no Excel-file will be generated. |
sheetName |
String for a user defined sheet name in the Excel file, where the results should saved. If NULL (the default), the sheet will be named automatically after the stratification variable. |
mode |
Handle the tables of numerical variables. In case of "auto" the tests and apropriate p-values will be choosen automatically. |
cat_freq |
Handle the tables of categorical variables. "abs" reports only absolute, "rel" only the proportions and "all" both statistics. |
exact |
Controls, wether the Fisher's exact test should be used instead of the Chi^2 test. |
p_values |
If TRUE, tests will be performed, otherwise not. |
alpha |
The significance level. |
rnd |
The number of digits of the decimal place. |
coloured_excel |
If TRUE and path not NULL, the saved Excel-sheet will be beautified for an better overview. |
cont_cor |
Controls, wether the continuity correction within the Chi^2 tests shoud be applied. |
strats |
Vector of stratification variables (analogously to strat of tbl1() ) |
Creates the table 1 for non paired samples with 2 or more groups. The function calculates the means, standard deviations, medians and IQRs for numerical variables. Furthermore it performs dependent on the number of groups the necessary parametric or non-parametric test. Furthermore, Tests for normality and homogeneity will be performed. In case of categorical variables frequencies and (rowwise or columnwise) proportions will be calculated. In addition to this a chi^2-test or if desired Fisher's exact-test will be performed.
Returns a list: "table1": the beautified table 1. "tbl_num": all statistics for numerical variables. "tbl_cat": all statistics for categorical variables. "tests_num": all tests used for numerical variables. "tests_cat": all tests used for categorical variables.
tbls1
: Applies tbl1() to multiple stratification variables
Dennis Freuer
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.