factorize: Factorize integer numbers and factors

factorizeR Documentation

Factorize integer numbers and factors

Description

Methods to factorize integer numbers into primes or factors into pseudo factors with integer numbers of levels

Usage


## S3 method for class 'factor'
factorize(x, name = deparse(substitute(x)), extension = letters,
    drop = FALSE, sep = "", ...)
## S3 method for class 'design'
factorize(x, extension = letters, sep = ".", long=FALSE, ...)
## S3 method for class 'data.frame'
factorize(x, extension = letters, sep = ".", long=FALSE, ...)

Arguments

x

factor
OR data frame of class design OR data frame

name

name to use for prefixing the pseudo factors

extension

extensions to use for postfixing the pseudo factors

drop

TRUE: have a vector only in case of just one pseudo factor

sep

separation between name and postfix for pseudo factors

long

TRUE: create a complete matrix of pseudofactors; FALSE: only create the named numbers of levels

...

currently not used

Details

These functions are used for blocking full factorials. The method for class factors is a modification of the analogous method from package conf.design, the other two are convenience versions for designs and data frames.

Value

All three methods return a matrix of pseudo factors (in case long=TRUE) or a named numeric vector of numbers of levels of the pseudo factors (for the default long=FALSE).

Note

There may be conflicts with functions from packages conf.design or sfsmisc.

Author(s)

Ulrike Groemping; Bill Venables authored the original of factorize.factor.

See Also

The function factorize from package conf.design,
the function factorize from package sfsmisc (no link provided, in order to avoid having to include sfsmisc in Suggests).

Examples

factorize(12)
factorize(c(2,2,3,3,6))
factorize(fac.design(nlevels=c(2,2,3,3,6)))
unlist(factorize(c(2,2,3,3,6)))
factorize(undesign(fac.design(nlevels=c(2,2,3,3,6))))

DoE.base documentation built on Nov. 15, 2023, 1:06 a.m.