summarize makes a simple description of a variable in one or more groups. It first tests if the variable has a normal distribution by a Shapiro-Wilk test. In the normal case the variable is summarized in mean and sd in each group. In other case it is summarized in median and percentiles (by default 25 and 75 percentiles). A comparison betweed two groups is made by a t.test in the normal case and by a wilcoxon test in other case. When there are more than two groups, anova F-test and Kruskal-Wallis test are used. Optionally histograms and boxplots are printed.
1 2 3 4 5 |
x |
variable to be summarized. |
by |
variable for identifying groups, interpreted as factor |
xlabel |
Label of the variable x, to be used in figures and tables. |
bylabel |
Label of the variable by, to be used in figures and tables. |
plot |
Logical. If TRUE a plot is printed |
ptiles |
ptiles to print with the median when variable is not normal. |
alphaNorm |
Significance level for testing normality. 0.05 by default. |
boxplot |
Should a boxplot be added under the histograms? |
rug |
must a rug be drawn at the base of the histograms? |
densityCurve |
Logical. Must a density curve be superposed to the histograms? |
normalCurve |
Logical. Must a normal curve be superposed to the histograms? |
report. |
If "auto" a Shapiro test is made; only mean and sd (if variable is accepted to be |
histogram. |
Should a histogram be drawn for each level of the factor variable? |
faceted. |
When FALSE histograms are superposed. When TRUE are shown separately |
addMeanLine. |
Should a vertical lines be added to the histogram at the position of the mean? |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.