mpone: Converts the first two levels of a factor into the numeric...

mponeR Documentation

Converts the first two levels of a factor into the numeric values -1 and +1

Description

Converts the first two levels of a factor into the numeric values -1 and +1.

Usage

mpone(factor)

Arguments

factor

The factor to be converted.

Value

A numeric vector.

Warning

If the factor has more than two levels they will be coerced to numeric values.

Author(s)

Chris Brien

See Also

mpone in package dae, factor, relevel.

Examples

## generate all combinations of two two-level factors
mp <- c("-", "+")
Frf3.trt <- fac.gen(list(A = mp, B = mp))

## add factor C, whose levels are the products of the levles of A and B
Frf3.trt$C <- factor(mpone(Frf3.trt$A)*mpone(Frf3.trt$B), labels = mp)

dae documentation built on June 22, 2024, 9:07 a.m.