contrastSampleIndices: Return indices of samples involved in the given contrast of...

contrastSampleIndicesR Documentation

Return indices of samples involved in the given contrast of two or more coefficients

Description

Return indices of samples involved in the given contrast of two or more coefficients

Usage

contrastSampleIndices(object, contrast)

## S4 method for signature 'DesignContrast,character'
contrastSampleIndices(object, contrast)

## S4 method for signature 'DesignContrast,numeric'
contrastSampleIndices(object, contrast)

Arguments

object

A DesignContrast object

contrast

Either a contrast name or a integer indicating the index of the contrast

Value

An integer vector, indices of samples that are involved, sorted by the ascending order of the coefficients of the contrast

Methods (by class)

  • contrastSampleIndices(object = DesignContrast, contrast = character): Use character string to specify the contrast

  • contrastSampleIndices(object = DesignContrast, contrast = numeric): Use integer indices to specify the contrast

Examples

## one-way ANOVA
myDesCon <- parseDesignContrast(sampleGroups="As,Be,As,Be,As,Be",
   groupLevels="Be,As", dispLevels="Beryllium,Arsenic", contrasts="As-Be")
contrastSampleIndices(myDesCon, 1L)
myInterDesCon <- DesignContrast(
    designMatrix=matrix(c(rep(1,6), rep(0,2), rep(1,2), rep(0,2),
           rep(0,4), rep(1,2)), nrow=6, byrow=FALSE),
    contrastMatrix=matrix(c(0,1,0, 0,0,1, 0,-1,1), byrow=FALSE, nrow=3),
    groups=factor(rep(c("As", "Be", "Cd"), each=2)),
    dispLevels=c("Arsenic", "Beryllium", "Cadmium"))
cont1Ind <- contrastSampleIndices(myInterDesCon, 1L)
cont2Ind <- contrastSampleIndices(myInterDesCon, 2L)
cont3Ind <- contrastSampleIndices(myInterDesCon, 3L)
stopifnot(identical(cont1Ind, 1:4))
stopifnot(identical(cont2Ind, c(1:2, 5:6)))
stopifnot(identical(cont3Ind, c(3:6)))

bedapub/ribiosExpression documentation built on Sept. 2, 2023, 4:37 a.m.