inst/extras/benchmark_geneset_stability.R

generate_data <- function(n_genes=100, n_samples=100) {
  # Create a list to store the matrices and labels
  data <- list()

  # Generate a matrix where all genes are perfectly correlated
  matrix1 <- matrix(rep(rnorm(n_samples), n_genes), nrow=n_samples, ncol=n_genes)
  colnames(matrix1) <- paste0("Gene", 1:n_genes)
  data$matrix1 <- matrix1

  # Generate a matrix where all genes are uncorrelated
  matrix2 <- matrix(rnorm(n_samples * n_genes), nrow=n_samples, ncol=n_genes)
  colnames(matrix2) <- paste0("Gene", 1:n_genes)
  data$matrix2 <- matrix2

  # Create a vector of labels with even class distribution
  labels <- rep(c(0, 1), each=n_samples/2)
  data$labels <- labels

  return(data)
}

Try the GeneSelectR package in your browser

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

GeneSelectR documentation built on May 29, 2024, 4:01 a.m.