rep_mean_sd {kdry} | R Documentation |
rep_mean_sd
Description
Reporting helper function: computes and formats mean and standard deviation from a numeric vector.
Usage
rep_mean_sd(
x,
digits = 2,
na.rm = TRUE,
sd_brackets = c("round", "square"),
sd_prefix = TRUE,
weighted = FALSE,
weights = NA
)
Arguments
x |
A numeric vector. |
digits |
An integer indicating the number of decimal places. |
na.rm |
A logical indicating if missings should be removed from |
sd_brackets |
A character. Either |
sd_prefix |
A logical. If |
weighted |
A logical. If |
weights |
A vector with the weights (if |
Value
A character with the formatted output.
See Also
mean()
, stats::sd()
, stats::weighted.mean()
,
Hmisc::wtd.var()
Examples
set.seed(123)
x <- rnorm(1000)
rep_mean_sd(x)
rep_mean_sd(rep(1, 10))
rep_mean_sd(x, sd_brackets = "square")
rep_mean_sd(x, sd_brackets = "square", sd_prefix = FALSE)