Learn R Programming

designr (version 0.1.13)

random.factors: Extract factors by type

Description

From a given design, extract contained random or fixed factors as a list.

Usage

random.factors(design, include_interactions = TRUE)

fixed.factors(design)

Value

A list of factors that are either fixed or random.

Arguments

design

The factor design to check.

include_interactions

Should random factor interactions be included?

Functions

  • random.factors(): Return fixed factors

Examples

Run this code

des <- fixed.factor("Factor1", c("1A","1B")) +
       fixed.factor("Factor2", c("2A","2B")) +
       random.factor("Subject", c("Factor1"))
       
random.factors(des)
fixed.factors(des)

stopifnot(setequal(names(random.factors(des)), c("Subject")))
stopifnot(setequal(names(fixed.factors(des)), c("Factor1","Factor2")))


Run the code above in your browser using DataLab