Learn R Programming

qwraps2 (version 0.6.1)

gmean_sd: Geometric Mean and Standard deviation

Description

A function for calculating and formatting geometric means and standard deviations.

Usage

gmean_sd(
  x,
  digits = getOption("qwraps2_frmt_digits", 2),
  na_rm = FALSE,
  show_n = "ifNA",
  denote_sd = "pm",
  markup = getOption("qwraps2_markup", "latex"),
  ...
)

Value

a character vector of the formatted values

Arguments

x

a numeric vector

digits

digits to the right of the decimal point to return in the percentage estimate.

na_rm

if true, omit NA values

show_n

defaults to “ifNA”. Other options are “always” or “never”.

denote_sd

a character string set to either "pm" or "paren" for reporting 'mean \(\pm\) sd' or 'mean (sd)'

markup

character string with value “latex” or “markdown”

...

pass through

Details

Given a numeric vector, gmean_sd will return a character string with the geometric mean and standard deviation. Formatting of the output will be extended in future versions.

See Also

mean_sd, gmean, gsd

Examples

Run this code

gmean_sd(mtcars$mpg, markup = "latex")
gmean_sd(mtcars$mpg, markup = "markdown")

Run the code above in your browser using DataLab