View source: R/calc_summ_stats.R
calc_summ_stats | R Documentation |
This function provide some brief overview statstics for selected variables of a tbl_df. Number of observations (n), complete observations (complete), missing observations (missing); mean, standard deviation (sd), minimum value (p0), maximum value (p100), median (p50), interquartile rane (p25, p75).
calc_summ_stats(.data, ...)
calc_summ_stats_t(.data, ...)
.data |
A tbl |
... |
Variables to summarise |
A tbl
library(dplyr)
library(ggplot2) # to get the starwars data set
# descriptive stats for height and mass
starwars %>%
calc_summ_stats(
height, mass
)
# Grouped by gender
starwars %>%
group_by(gender) %>%
calc_summ_stats(
height, mass
)
# Derive variables within function then summarise
starwars %>%
calc_summ_stats_t(
heightm = height / 100,
bmi = mass / heightm^2
)
# Grouped by gender
starwars %>%
group_by(gender) %>%
calc_summ_stats_t(
heightm = height / 100,
bmi = mass / heightm^2
)
# Doesn't work with factors/characters as of 2018-01-19
# starwars %>%
# calc_summ_stats(
# height, mass, gender
# )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.