Learn R Programming

designr (version 0.1.13)

is.randomFactor: Checking factor design data types

Description

Check if argument is a design factor (either random or fixed factor), specifically a random factor, a fixed factor or a factor design.

Usage

is.randomFactor(fac)

is.fixedFactor(fac)

is.factorDesign(fac)

is.designFactor(fac)

Value

TRUE or FALSE

Arguments

fac

Object to check.

Functions

  • is.randomFactor(): Check if argument is a random factor.

  • is.fixedFactor(): Check if argument is a fixed factor.

  • is.factorDesign(): Check if argument is a factor design.

Examples

Run this code

x <- fixed.factor("factor", c("level1","level2"))
y <- random.factor("factor")

stopifnot(is.fixedFactor(x) && !is.randomFactor(x))
stopifnot(!is.fixedFactor(y) && is.randomFactor(y))
stopifnot(is.designFactor(x) && is.designFactor(y))

Run the code above in your browser using DataLab