| fmt_mean_sd | R Documentation | 
A function to calculate and format a mean and standard deviation.
fmt_mean_sd(x, format = "%.1f", sd_format = NULL)
x | 
 The input data vector or data frame column.  | 
format | 
 A formatting string suitable for input into the 
  | 
sd_format | 
 An optional format for the standard deviation. If this parameter is not supplied, the standard deviation will be formatted the same as the mean, according to the 'format' parameter.  | 
This function calculates a mean and standard deviation, and formats using
sprintf. 
You may control the format using the format parameter.  
Function will ignore NA values in the input data. Results are 
returned as a character vector.
The formatted mean and standard deviation.
Other helpers: 
fmt_cnt_pct(),
fmt_median(),
fmt_n(),
fmt_quantile_range(),
fmt_range()
v1 <- c(4.3, 3.7, 8.7, 6.1, 9.2, 5.6, NA, 0.7, 7.8, 4.9)
# Format mean and standard deviation
fmt_mean_sd(v1)
# "5.7 (2.7)"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.