my_summary: Custom Summarization for a variable in a dataframe

View source: R/my_summary.R

my_summaryR Documentation

Custom Summarization for a variable in a dataframe

Description

Uses 'dplyr' style summarization to retrun mean, SD, n, SEM, and 95 single continuous variable in a dataframe. Useful for grouped data summaries.

Usage

my_summary(df, my_var, probs = c(0.025, 0.975), na.rm = T, digits = 2)

Arguments

df

A dataframe

my_var

A variable name

probs

For quantile functions, a vector with the desired quantiles...c(0.025, 0.975) default

na.rm

a logical value indicating whether NA values should be stripped

digits

integer indicating number of decimal places

Value

A dataframe with named variables for: mean, sd, n, sem, and 95

See Also

summarise, mean, sd, round, quantile

Examples

library(dplyr)
my_summary(mtcars, mpg)
mtcars %>% group_by(cyl) %>% my_summary(mpg)
mtcars %>% group_by(cyl) %>% my_summary(mpg, probs = c(0.01, .999), digits = 0)

JMLuther/tabletools documentation built on July 1, 2024, 2:01 p.m.