subset_by_frequency: Subset a Binary Matrix By Alteration Frequency Threshold

View source: R/subset-by-frequency.R

subset_by_frequencyR Documentation

Subset a Binary Matrix By Alteration Frequency Threshold

Description

Subset a Binary Matrix By Alteration Frequency Threshold

Usage

subset_by_frequency(gene_binary, t = 0.1, other_vars = NULL, by = NULL)

Arguments

gene_binary

A data frame with a row for each sample and column for each alteration. Data frame must have a sample_id column and columns for each alteration with values of 0, 1 or NA.

t

Threshold value between 0 and 1 to subset by. Default is 10% (.1).

other_vars

One or more column names (quoted or unquoted) in data to be retained in resulting data frame. Default is NULL.

by

Variable used to subset the data. Default is NULL.

Value

a data frame with a sample_id column and columns for alterations over the given prevalence threshold of t.

Examples

samples <- unique(gnomeR::mutations$sampleId)
 gene_binary <- create_gene_binary(
   samples = samples, mutation = mutations, cna = cna,
   mut_type = "somatic_only",
   include_silent = FALSE,
   specify_panel = "impact"
 )
gene_binary %>%
 subset_by_frequency()


MSKCC-Epi-Bio/gnomeR documentation built on Oct. 17, 2024, 3:39 p.m.