fmsd: Compute the mean and the sd of a vector and format them to...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/fmsd.R

Description

A function to compute the mean and the standard deviation (sd) and return a formatted string as mean (sd) or as (mean +- sd) to be used a Markdown/LaTeX format according to the APA guidelines.

Usage

1
fmsd(data, pm = FALSE, toround = c(2, 1))

Arguments

data

A vector of values to used to compute the mean and the standard deviation (sd).

pm

A logical value to format the mean and the sd all in parentheses. Defaults to FALSE.

toround

A vector of length 2 to indicate how to round (1) the mean and (2) the standard deviation.

Value

Return a string reporting an inline mean and standard deviation (sd) according to the APA guideline.

Author(s)

Guillaume T. Vallet gtvallet@gmail.com, University of de Montreal (Canada);

See Also

faov, ftt

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Generate fake data:
data = rnorm(10, mean=555, sd=35)

# Formatting as mean (sd)
fmsd(data)

# Formatting as (mean +- sd)
fmsd(data, pm=T)    

# Formatting with no decimals
fmsd(data, toround=c(0,0))

Cogitos/statxp documentation built on March 22, 2021, 6:38 a.m.