Skip to contents

Perform a t-test and return summary statistics

Usage

ttest.analysis(values, groups, alternative = "two.sided");

Arguments

values

Vector of values to be analyzed

groups

Factor variable with two levels indicating which entries in 'values' belong to which group for the t-test comparison

alternative

Type of alternative hypothesis to be used ("two.sided", "greater", or "less"). Defaults to "two.sided".

Value

Data frame with relevant statistics

Author

Nathalie Moon

Examples

ttest.analysis(values = c(rnorm(n=50, mean=0), rnorm(n=50, mean=10)), 
    groups = factor(c(rep('A', times=50), rep('B', times=50))));
#>   statistical.method alternative.hypothesis       pvalue group.1 group.2
#> 1              ttest              two.sided 5.224192e-72       A       B
#>   mean.group.1 mean.group.2
#> 1     -0.11386      10.0614