Learn R Programming

mosaic (version 0.9-0)

t.test: Student's t-Test

Description

Performs one and two sample t-tests. The mosaic t.test provides wrapper functions around the function of the same name in stats. These wrappers provide an extended interface that allows for a more systematic use of the formula interface.

rdname ttest

Usage

## S3 method for class 'test':
t(x, ...)

ttest(x, ...)

## S3 method for class 'default': ttest(x, ...)

## S3 method for class 'formula': ttest(x, data = parent.frame(), groups = NULL, ...)

Arguments

x
an object (e.g., a formula or a numeric vector)
data
a data frame
groups
x = ~ var, groups=g is equivalent to x = var ~ g.
...
additional arguments, see t.test in the stats package.

Value

  • an object of class htest

Details

This is a wrapper around t.test from the stats package to extend the functionality of the formula interface.

See Also

prop.test, t.test

Examples

Run this code
t.test( ~ age, data=HELPrct)
t.test( age ~ sex, data=HELPrct)
t.test( ~ age | sex, data=HELPrct)
t.test( ~ age, groups=sex, data=HELPrct)

Run the code above in your browser using DataLab