mean_sd {PAutilities}R Documentation

Compute the mean and standard deviation of a vector, returning a formatted string containing the values as 'M +/- SD'

Description

Compute the mean and standard deviation of a vector, returning a formatted string containing the values as 'M +/- SD'

Usage

mean_sd(
  x = NULL,
  MoreArgs = NULL,
  give_df = TRUE,
  ...,
  mean_x = NULL,
  sd_x = NULL
)

## Default S3 method:
mean_sd(
  x = NULL,
  MoreArgs = NULL,
  give_df = TRUE,
  ...,
  mean_x = NULL,
  sd_x = NULL
)

## S3 method for class 'data.frame'
mean_sd(
  x = NULL,
  MoreArgs = NULL,
  give_df = TRUE,
  ...,
  mean_x = NULL,
  sd_x = NULL
)

Arguments

x

numeric vector of values to summarize

MoreArgs

named list of arguments to pass to mean and sd

give_df

logical. Should mean, sd, and summary string be returned in a data frame?

...

additional arguments passed to format

mean_x

an already-calculated mean value for x

sd_x

an already-calculated sd value for x

Value

either a formatted character scalar (if give_df == FALSE), or else a data frame containing columns for the mean value, standard deviation, and formatted character string combining the two.

Examples

mean_sd(rnorm(100, 50))


[Package PAutilities version 1.2.1 Index]