summarize: Univariate summary of a variable for each level of a factor...

Description Usage Arguments

Description

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.

Usage

1
2
3
4
5
summarize(x, by = NULL, xlabel = NULL, bylabel = NULL, plot = TRUE,
  ptiles = c(0.25, 0.75), alphaNorm = 0.05, report = "auto",
  histogram = TRUE, boxplot = TRUE, rug = TRUE, faceted = TRUE,
  densityCurve = TRUE, normalCurve = FALSE, addMeanLine = TRUE,
  digits = 2, showSummary = TRUE)

Arguments

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?


angeloSdP/ULPGCmisc documentation built on May 10, 2019, 11:47 a.m.