calc_summ_stats: Title Calculate summary / descriptive statistics

View source: R/calc_summ_stats.R

calc_summ_statsR Documentation

Title Calculate summary / descriptive statistics

Description

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).

Usage

calc_summ_stats(.data, ...)

calc_summ_stats_t(.data, ...)

Arguments

.data

A tbl

...

Variables to summarise

Value

A tbl

Examples

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
#  )


emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.