display_table {quickReg} | R Documentation |
Display a table used in paper
Description
Display count, frequency or mean, standard deviation and test of normality, etc.
Usage
display_table(data = NULL, variables = NULL, group = NULL,
mean_or_median = "mean", addNA = TRUE, table_margin = 2,
discrete_limit = 10, exclude_discrete = TRUE, save_to_file = NULL,
normtest = NULL, fill_variable = FALSE)
display_table_group(data = NULL, variables = NULL, group = NULL,
super_group = NULL, group_combine = FALSE, mean_or_median = "mean",
addNA = TRUE, table_margin = 2, discrete_limit = 10,
exclude_discrete = TRUE, normtest = NULL, fill_variable = FALSE)
Arguments
data |
A data.frame |
variables |
Column indices or names of the variables in the dataset to display, the default columns are all the variables except group variable |
group |
Column indices or names of the first subgroup variables. Must provide. |
mean_or_median |
A character to specify mean or median to used for continuous variables, either "mean" or "median". The default is "mean" |
addNA |
Whether to include NA values in the table, see |
table_margin |
Index of generate margin for, see |
discrete_limit |
Defining the minimal of unique value to display the variable as count and frequency, the default is 10 |
exclude_discrete |
Logical, whether to exclude discrete variables with more unique values specified by discrete_limit |
save_to_file |
A character, containing file name or path |
normtest |
A character indicating test of normality, the default method is |
fill_variable |
A logical, whether to fill the variable column in result, the default is FALSE |
super_group |
Column indices or names of the further subgroup variables. |
group_combine |
A logical, subgroup analysis for combination of variables or for each variable. The default is FALSE (subgroup analysis for each variable) |
Functions
-
display_table_group
: Allow more subgroup analysis, see the package vignette for more details
Note
The return table is a data.frame.
- P.value1 is ANOVA P value for continuous variables and chi-square test P value for discrete variables
- P.value2 is Kruskal-Wallis test P value for continuous variables and fisher test P value for discrete variables if expected counts less than 5
- normality is normality test P value for each group
Examples
## Not run:
data(diabetes)
head(diabetes)
library(dplyr);library(rlang)
result_1<-diabetes %>%
group_by(sex) %>%
do(display_table(data=.,variables=c("age","smoking"),group="CFHrs2230199")) %>%
ungroup()
result_2<-display_table_group(data=diabetes,variables=c("age","smoking"),
group="CFHrs2230199",super_group = "sex")
identical(result_1,result_2)
result_3<-display_table_group(data=diabetes,variables=c("age","education"),
group=c("smoking"),super_group = c("CFHrs2230199","sex"))
result_4<-display_table_group(data=diabetes,variables=c("age","education"),
group=c("smoking"),super_group = c("CFHrs2230199","sex"),group_combine=TRUE)
## End(Not run)