Learn R Programming

infoDecompuTE (version 0.6.2)

makeBlkDesMat: Construct Block Design Matrix

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

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.

See Also

terms

Examples

Run this code
# NOT RUN {

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)



# }

Run the code above in your browser using DataLab