md.ttest: Run a t-test and return neatly formatted output 'x', and...

Description Usage Arguments Value Examples

View source: R/ttest.R

Description

Run a t-test and return neatly formatted output x, and either y or mu must be specified.

Usage

1
md.ttest(x, y = NULL, labels = NULL, mu = NULL, paired = F, ...)

Arguments

x

vector for testing

y

additional vector for testing. If singular, functions as mu

labels

vector of labels for x and y. If NULL, use attr(., 'label'), NA to suppress this behaviour.

mu

value against which x will be tested

paired

whether observations are paired (e.g. repeated measures)

...

Arguments passed on to md.mean

vector

data in

label

markdown prefix for the stats

conf.int

width of the confidence intervals, NA to suppress

na.rm

whether NA values are removed before averaging

decimals

decimal places to round to

isProportion

whether to print the values as proportions (strip leading 0)

showRange

whether to include the range of the data

Value

formatted string like t(df) = 3.68, p < .05, d = 0.23, BF = 4.50; M1 = 3.05 [1.23, 4.55], M2 = 5.12 [4.20, 5.99]

Examples

1
2
3
data <- data.frame(x = rnorm(100), y = rnorm(100, 0.2)) # two normal distributions with some overlap
tt <- md.ttest(data$x, data$y, c('Mean~Control~', 'Mean~Treatment~'), paired = TRUE)
cat(tt)

mjaquiery/prettyMD documentation built on Oct. 6, 2021, 4:16 p.m.