summ {mStats} | R Documentation |
Summary statistics
Description
summ()
calculates and displays a variety of summary statistics.
If no variables are specified, summary statistics are calculated
for all the variables in the dataset.
Usage
summ(data, ..., by = NULL, na.rm = FALSE, digits = 1, detail = FALSE)
Arguments
data |
data.frame |
... |
variable name or names of multiple variables |
by |
variable name for bivariate analysis |
na.rm |
logical: if |
digits |
specify rounding of numbers. |
detail |
logical: if |
Details
It calculates seven number summary statistics, and p-values from relevant statistical tests of association.
ANNOTATIONS
Obs
= Number of observations
NA
= Number of observations with missing value
Mean
= Mean
Std.Dev
= Standard deviation
Median
= Median value
25%
= First quartile or percentile
75%
= Third quartile or percentile
Min
= Minimum value
Max
= Maximum value
Normal
= p-value from Shapiro-Wilk Normality Test
Grouped summary statistics
If a strata variable by
is specified, grouped summary statistics
are calculated. In addition, based on the levels of by
,
relevant statistical tests of association such as Student's t-test
and Wilcoxon, ANOVA and Kruskal-Wallis tests are calculated and their
associated p-values are displayed.
Tabulating the whole dataset
This is helpful when the dataset has been processed and finalized.
The final dataset can be fed into the function without
inputting any variables. This automatically filters and generates
tables on variables with possible data types for summary statistics. These
data types include numeric
, double
, integer
, and logical
.
Using colon :
to summarize multiple variables
A colon separator :
can be used to summarize variables more efficiently.
Labels
Labels for corresponding variables are displayed below the table.
Value
A list with summ
class containing three sets of data.frame type:
summary result,
summary result without any format,
labels for corresponding variables.
Author(s)
Email: dr.myominnoo@gmail.com
Website: https://myominnoo.github.io/
Examples
## Univariate summary statistics
summ(iris, Sepal.Length)
summ(iris, Sepal.Length:Petal.Width)
## Bivariate summary statistics
summ(iris, Sepal.Length:Petal.Width, by = Species)
## Not run:
## Using the whole dataset
summ(iris)
summ(iris, by = Species)
## Detailed summary statistics
summ(iris, detail = TRUE)
summ(iris, by = Species, detail = TRUE)
## End(Not run)