Learn R Programming

PAutilities (version 1.1.0)

mean_sd: 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
)

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

# S3 method for 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

Examples

Run this code
mean_sd(rnorm(100, 50))

Run the code above in your browser using DataLab