R/createMatForLayoutInQQplot.R

Defines functions createMatForLayoutInQQplot

Documented in createMatForLayoutInQQplot

#' Create a matrix for figure layout of "pair-wise comparisons type"
#' 
#' @param numColDF Number of columns in dataframe for which pairwise comparisons are performed.
#' @author Alexander Kheirallah ([email protected])
#' @export
#' 

createMatForLayoutInQQplot <- function(numColDF) {
  numOfCom <- ncol(combn(numColDF,2))
  m.out <- matrix(nrow = numColDF-1, ncol = numColDF-1)
  comSeq <- 1:numOfCom
  for ( i in 1:nrow(m.out)) {
    m.out[i,] <- c(comSeq[1:i], rep(0,numColDF-1-i))  # assigns the first i elements from comSeq to the matrix
    comSeq <- comSeq[(i + 1):length(comSeq)]          # removes the first i elements from comSeq
  }
  return(m.out)
}
msxakk89/dat documentation built on April 3, 2020, 5:39 p.m.