Learn R Programming

GimmeMyStats (version 1.0.0)

print_dispersion: Prints the dispersion of a numeric vector

Description

Calculates and prints the median and interquartile range (IQR) or the mean and standard deviation (SD).

Usage

print_dispersion(x, digits = 1, width = 15, method = "median")

Value

A character string containing a measure of central tendency and dispersion. Depending on method, this is either the median and interquartile range or the mean and standard deviation.

Arguments

x

Vector containing numerical values.

digits

Integer specifying the number of decimal places for the test statistic.

width

Integer specifying the maximum width for wrapping text.

method

Character specifying the method: median for median and IQR, or mean for mean and SD.

Examples

Run this code
print_dispersion(runif(10))
print_dispersion(runif(10), method = "mean", digits = 2, width = 5)

Run the code above in your browser using DataLab