R/remove_skpr_blockcols.R

Defines functions remove_skpr_blockcols

Documented in remove_skpr_blockcols

#'@title Remove skpr-generated blocking columns
#'
#'@description Remove skpr-generated REML blocking columns if present
#'@param RunMatrix The run matrix
#'@return Run Matrix
#'@keywords internal
remove_skpr_blockcols = function(RunMatrix) {
  if (!is.null(attr(RunMatrix, "splitanalyzable"))) {
    if (attr(RunMatrix, "splitanalyzable")) {
      allattr = attributes(RunMatrix)
      remove_cols = which(colnames(RunMatrix) %in% allattr$splitcolumns)
      if(length(remove_cols) > 0) {
        RunMatrix = RunMatrix[, -remove_cols, drop = FALSE]
        allattr$names = allattr$names[-remove_cols]
      }
      attributes(RunMatrix) = allattr
    }
  }
  return(RunMatrix)
}

Try the skpr package in your browser

Any scripts or data that you put into this service are public.

skpr documentation built on May 29, 2024, 5:06 a.m.