Learn R Programming

standardize (version 0.2.2)

fac_and_contr: Create a factor and specify contrasts.

Description

The fac_and_contr function is a convenience function which coerces x to a factor with specified levels and contrasts.

Usage

fac_and_contr(x, levels, contrasts, ordered = FALSE)

Arguments

x

An object coercible to factor.

levels

A character vector of levels for the factor.

contrasts

A matrix of contrasts for the factor.

ordered

A logical indicating whether or not the factor is ordered (default FALSE).

See Also

named_contr_sum (unordered factors) and scaled_contr_poly (ordered factors).