intr | R Documentation |
Calculate summary statistic with range or confidence interval.
intr(..., fun = median, conf = NULL, digits = 0L, na.rm = FALSE)
intr2(
...,
fun = median,
na.rm = FALSE,
digits = 0L,
conf.int = 0.95,
range = TRUE,
ci = FALSE,
sd = FALSE,
mad = FALSE,
iqr = FALSE
)
... |
numeric vector or string of numeric vectors |
fun |
summary stat function, usually |
conf |
width of confidence interval in |
digits |
number of digits (includes trailing 0s) |
na.rm |
logical; if |
conf.int |
for |
range , ci , sd , mad , iqr |
logical; for |
roundr
x <- 1:10
intr(x)
intr(x, conf = 0.95)
## inner quartile range
cbind(
'median (IQR)' = lapply(mtcars, intr, conf = 0.5, digits = 2),
'mean (range)' = lapply(mtcars, intr, fun = mean, digits = 2)
)
## compare to
summary(mtcars)
x <- mtcars$mpg
intr2(x)
intr2(x, fun = mean, sd = TRUE, ci = TRUE, conf.int = 0.9)
## compare
x <- list(mtcars$mpg, mtcars$wt)
intr2(x, range = TRUE, iqr = TRUE, digits = 2)
summary(mtcars[, c('mpg', 'wt')])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.