Learn R Programming

wrMisc (version 2.1.0)

sampNoDeMArrayLM: Locate Sample Index From Index Or Name Of Pair-Wise Comparisons In List Or MArrayLM-Object

Description

When multiple series of data are tested simultaneaously (eg using moderTestXgrp), multiple pairwise comparisons get performed. This function helps locating the groups of samples, eg respective mean-columns, corresponding to specific pairwise comparisons.

Usage

sampNoDeMArrayLM(
  MArrayObj,
  useComp = NULL,
  outTy = "index",
  groupSep = NULL,
  combPwSep = "combine1",
  silent = FALSE,
  debug = FALSE,
  callFrom = NULL
)

Value

This function returns if outTy="names" a numeric vector with indexes indicating the sorted (!!) columns of (replicate) mean-values corresponding to the comparison specified in useComp; or if outTy="names" or outTy="pwGrpNa" : the (separated) names of pairwise groups will be returned as matrix (each pairwise question as separate line) or if outTy="list" a list with $index0 (sorted unique vector or indexes), $pwGrpNa (the separated pairwise group-names), $pwIndex (the ith pairwise comparison), $concat (the concatenated pairwise names), $sep (pairwise separator) and $compIndex

Arguments

MArrayObj

(list or MArray-object) main input, object to examine and extract pairwise question information

useComp

(character or integer, length=1) index or name of pairwise-comparison to be addressed

outTy

(character) choose if just vector of indexes (with outTy="index0"), matrix of indexes (organized by pairwise questions, with outTy="index"), or matrix of group-names (with outTy="names") or list with $index0 (osrted unique vector or indexes), $pwGrpNa, $pwIndex, $concat, $sep and $compIndex will get returned

groupSep

(NULL or character of length=1) separator for pair of names; if NULL a suitable separator (among '-','--','_','__','.',' ' and ' ') will be used

combPwSep

(character) sequence of separators for building combined names (may be combPwSep='combine1' or 'combine2'); will be used in pwSeparatorList()

silent

(logical) suppress messages

debug

(logical) additional messages for debugging

callFrom

(character) allow easier tracking of messages produced

Details

As main input one gives a list or MArrayLM-object containing testing results from pairwise comparisons, and specific comparisons indicated by useComp to get located in the elements of mean-columns (lstMeans).

Note, that that the numeric indexes should be used with caution as they refer to the levels of the groups which are sorted and thus not necessarily in the order of other elements like the group-means.

This function allows finding inverted questions (eg 'D-C' even though 'C-D' was actually run in testing), but the result will always be presented in the initial order

See Also

moderTestXgrp, this function gets used eg in MAplotW or VolcanoPlotW

Examples

Run this code
grp3 <- factor(rep(LETTERS[4:2], c(2,3,3)))
set.seed(2017); t8 <- matrix(round(rnorm(208*8,10,0.4), 2), ncol=8,
  dimnames=list(paste(letters[],rep(1:8,each=26),sep=""), paste0(grp3,c(1:2,1:3,1:3))))
if(requireNamespace("limma", quietly=TRUE)) {  # need limma installed...
  test8 <- moderTestXgrp(t8, grp3, useComparison="all") 
  head(test8$p.value)         # all pairwise comparisons available
  sampNoDeMArrayLM(test8, 3)   
  levels(grp3)[sampNoDeMArrayLM(test8, 3)]
  head(test8$means[,sampNoDeMArrayLM(test8, 3, outTy="names")], 3)      
  head(test8$means[,sampNoDeMArrayLM(test8, "D-C", outTy="names")], 3) # inverted question
} 

Run the code above in your browser using DataLab