View source: R/describe_stats.R
describe_stats | R Documentation |
This function provides a range of descriptive statistics that are useful to explore numeric data. If a grouping variable is specified, the descriptive statistics are computed separately for each group.
describe_stats(data, .cols, .group = NULL)
data |
A data frame. |
.cols |
< |
.group |
< |
A tibble or a tibble grouped by .group
containing
the following statistics:
n
Number of valid observations
missings
Percentage of missings
mean
Mean
sd
Standard deviation
min
Minimum
p25
25th percentile
median
Median
p75
75th percentile
max
Maximum
mean_h
Harmonic mean
skewness
Skewness
kurtosis
Kurtosis
# -- Simple descriptive statistics across all observations
# compute descriptive statistics for students' mathematics achievement
# using the name of the variable
describe_stats(studach, .cols = math)
# using the position by column number
describe_stats(studach, .cols = 11)
# compute descriptive statistics for all numeric variables
describe_stats(studach, .cols = where(is.numeric))
# -- Descriptive statistics by school type or gender
describe_stats(studach, .cols = math, .group = ts_name)
describe_stats(studach, .cols = math, .group = gender)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.