File: desc_statby.Rd

package info (click to toggle)
r-cran-ggpubr 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,240 kB
  • sloc: makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,499 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/desc_statby.R
\name{desc_statby}
\alias{desc_statby}
\title{Descriptive statistics by groups}
\usage{
desc_statby(data, measure.var, grps, ci = 0.95)
}
\arguments{
\item{data}{a data frame.}

\item{measure.var}{the name of a column containing the variable to be summarized.}

\item{grps}{a character vector containing grouping variables; e.g.: grps = c("grp1", "grp2")}

\item{ci}{the percent range of the confidence interval (default is 0.95).}
}
\value{
A data frame containing descriptive statistics, such as:
\itemize{
\item \strong{length}: the number of elements in each group
\item \strong{min}: minimum
\item \strong{max}: maximum
\item \strong{median}: median
\item \strong{mean}: mean
\item \strong{iqr}: interquartile range
\item \strong{mad}: median absolute deviation (see ?MAD)
\item \strong{sd}: standard deviation of the sample
\item \strong{se}: standard error of the mean. It's calculated as the sample standard deviation divided by the root of the sample size.
\item \strong{ci}: confidence interval of the mean
\item \strong{range}: the range = max - min
\item \strong{cv}: coefficient of variation, sd/mean
\item \strong{var}: variance, sd^2
}
}
\description{
Computes descriptive statistics by groups for a measure variable.
}
\examples{
# Load data
data("ToothGrowth")

# Descriptive statistics
res <- desc_statby(ToothGrowth, measure.var = "len",
   grps = c("dose", "supp"))
head(res[, 1:10])

}