Learn R Programming

infoDecompuTE (version 0.5.1)

makeBlkDesMatrix: Make Block Design Matrix

Description

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

Usage

makeBlkDesMatrix(design.df, blkTerm)

Arguments

design.df
a data frame containing the design of the experiment. Every column must be factors.
blkTerm
a list of block terms generated from the terms function.

Value

This function returns a list of the binary matrices.

See Also

terms

Examples

Run this code
  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)
  })

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

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

Run the code above in your browser using DataLab