qstats: Summary statistics for a quantitative variable

Description Usage Arguments Value Examples

View source: R/qstats.r

Description

This function provides descriptive statistics for a quantitative variable alone or seperately by groups. Any function that returns a single numeric value can bue used.

Usage

1

Arguments

data

data frame

x

numeric variable in data (unquoted)

...

list of grouping variables

statistics

statistics to calculate (any function that produces a numeric value), Default: c("n", "mean", "sd")

na.rm

if TRUE, delete cases with missing values on x and or grouping variables, Default: TRUE

digits

number of decimal digits to print, Default: 2

Value

a data frame, where columns are grouping variables (optional) and statistics

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# If no keyword arguments are provided, default values are used
qstats(mtcars, mpg, am, gear)

# You can supply as many (or no) grouping variables as needed
qstats(mtcars, mpg)

qstats(mtcars, mpg, am, cyl)

# You can specify your own functions (e.g., median,
# median absolute deviation, minimum, maximum))
qstats(mtcars, mpg, am, gear,
       stats = c("median", "mad", "min", "max"))

Rkabacoff/qacr documentation built on March 20, 2021, 3:03 p.m.