summ: Summarize a Vector of Quantities

Description Usage Arguments Value See Also Examples

View source: R/summ.R

Description

This function is a wrapper for mean(), quantile(), sd, round(), and prettyNum(). So it can easily be called with less code. Also, nice to be able place these calls in apply() call.

Usage

1
summ(x, p = c(0.5, 0.025, 0.975), rnd = NULL, na.rm = F, prettify = FALSE)

Arguments

x

A numeric vector with length > 1. It can have NA elements.

p

A numeric vector with elements on the interval (0,1). The quantile points requested. Defaults to c(0.5, 0.025, 0.975).

rnd

A numeric vector of length == 1. The rounding specification. Defaults to NULL, i.e., no rounding.

na.rm

logical. Do you wish to remove NA elements before calculating summary statistics? Defaults to FALSE.

prettify

logical. Do you wish to insert commas in the output? If so, it will be coerced to a character vector. Defaults to FALSE.

Value

A vector with length depending on the requested quantiles. If isTRUE(prettify), output will be a named character vector, otherwise, it will be a named numeric vector.

See Also

round, quantile

Examples

1
2
3
4
summ(x = rnorm(100, 50000, 5000))
summ(x = rnorm(100, 50000, 5000),
     p = c(0.025, 0.1, 0.25, 0.5, 0.75, 0.9, 0.975),
     rnd = -3, prettify = T)

bstaton1/StatonMisc documentation built on May 18, 2020, 12:06 a.m.