Makes descriptive statistics of a data frame according to a group covariate or not, can export the results
desc(
data,
vars,
group = NULL,
whole = TRUE,
vars.labels = vars,
group.labels = NULL,
type.quanti = "mean",
test.quanti = "param",
test = TRUE,
noquote = TRUE,
justify = TRUE,
digits = 2,
file.export = NULL,
language = "english"
)A matrix of the descriptive statistics
data frame to describe in which we can find vars and group
vector of character strings of the covariates to describe
character string, statistics created for each levels of this covariate
boolean, TRUE to add a column with the whole statistics when comparing groups (set to FALSE if group=NULL)
vector of character string for sweeter names of covariates in the output
vector of character string for sweeter column names
character string, "med" to compute median [Q1;Q3], "mean" to compute mean (sd), "mean_med" to compute both mean (sd) and median [Q1;Q3] or "med_mm", "mean_mm" or "mean_med_mm" to add (min;max)
character string, "param" to compute parametric tests for quantitative covariates (t-test or ANOVA) or "nonparam" for non parametric tests (Wilcoxon test or Kruskal-Wallis test)
boolean, TRUE to perform tests (FALSE if group is NULL): Khi-2 or Fisher exact test for categorical covariates, t-test/ANOVA or Wilcoxon/Kruskal-Wallis Rank Sum Test for numerical covariates
boolean, TRUE to hide quotes when printing the table
boolean, TRUE to justify columns on right or left (FALSE if export)
number of digits of the statistics (mean, sd, median, min, max, Q1, Q3, %), p-values always have 3 digits
character string, name of the XLS file exported
character string, "french" or "english"
Hugo Varet
cgd$steroids=factor(cgd$steroids)
cgd$status=factor(cgd$status)
desc(cgd,vars=c("center","sex","age","height","weight","steroids","status"),group="treat")
Run the code above in your browser using DataLab