summary_se: Calculate mean and standard error

View source: R/stats.R

summary_seR Documentation

Calculate mean and standard error

Description

This function will take an input data.frame and summarize a specified numeric column. The summary will include mean, standard error, and a confidence interval corresponding to the width specified (see ".ci" argument). The function leverages tidy eval internally and can accommodate bare column names.

Usage

summary_se(.data, measure_var, ..., .ci = 0.95, na.rm = TRUE)

Arguments

.data

A data.frame or data.frame extension (e.g. tibble)

measure_var

Bare column name for variable to summarize

...

Optional bare column names for grouping variables

.ci

Width of confidence interval; default is 0.95

na.rm

Boolean indicating whether or not to use the na.rm argument in mean() and sd() functions; default is TRUE

Details

The inspiration for this function was Winston Chang's summarySE() function from "The Cookbook for R". As mentioned in that text, this method of computing standard error is only appropriate for between group variation. If there is within subject variation (repeated measures) use another method (see references below).

Value

Tibble with columns for grouping variables (if any) and summarized values for mean ("mean"), standard error ("se"), and confidence interval ("ci").

References

http://www.cookbook-r.com/Manipulating_data/Summarizing_data/

http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/#error-bars-for-within-subjects-variables

Examples

summary_se(.data = ToothGrowth, measure_var = len, supp, dose)

vpnagraj/yawp documentation built on March 31, 2022, 9:56 a.m.