R/extract_gene_names.R

Defines functions extract_gene_names

Documented in extract_gene_names

#' Creates a ordered list of colnames of a given Matrix
#'
#' This function orders the columns of a matrix by variance starting with the highest within column variance
#' left to the lowest within column variance on the right.
#'
#' @param matrix a numerical matrix
#'
#' @return vector containing colnames
#' @export
#'
#' @examples
#' \dontrun{
#' colnames <- matrix %>%
#'   extract_gene_names()
#' }
extract_gene_names <- function(matrix){

  #Sortes columns by column variance starting with highest var left to lowest war right and
  #stores ordered colnames in a character vector
  colnames <- matrix %>%
    apply(2,var) %>%
    sort(decreasing = TRUE)

  return (colnames)
  }
ECSchmitt/PPClustA documentation built on Dec. 17, 2021, 5:36 p.m.