makeBlkDesMat: Construct Block Design Matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/makeBlkDesMat.R

Description

Construct a binary matrix representing the block design. The rows are corresponding to the observations and the columns are corresponding to the blocks.

Usage

1
makeBlkDesMat(design.df, blkTerm)

Arguments

design.df

a data frame containing the experimental design. Requires every column be a factor.

blkTerm

a vector of character containing the labels of the block terms in the model generated by the terms.

Value

A list of the binary matrices.

Author(s)

Kevin Chang

See Also

terms

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
design1 <- local({ 
  Ani = as.factor(LETTERS[c(1,2,3,4,
                            5,6,7,8)])
  Trt = as.factor(letters[c(1,1,1,1,
                            2,2,2,2)])
  data.frame(Ani, Trt, stringsAsFactors = TRUE )
})

blk.str = "Ani*Trt"
    
rT = terms(as.formula(paste("~", blk.str, sep = "")), keep.order = TRUE) 

blkTerm = attr(rT,"term.labels")
Z = makeBlkDesMat(design1, blkTerm)

kcha193/infoDecompuTE documentation built on April 20, 2020, 8:30 a.m.