bin_columns_into_quantiles: 'bin_columns_into_quantiles'

View source: R/bin_columns_into_quantiles.r

bin_columns_into_quantilesR Documentation

bin_columns_into_quantiles

Description

bin_columns_into_quantiles is an internal function used to convert a vector of specificity into a vector of specificity quantiles. This function can be iterated across a matrix using apply to create a matrix of specificity quantiles.

Usage

bin_columns_into_quantiles(
  vec,
  numberOfBins = 40,
  defaultBin = as.integer(numberOfBins/2)
)

Arguments

vec

The vector of gene of specificity values.

numberOfBins

Number of quantile bins to use (40 is recommended).

defaultBin

Which bin to assign when there's only one non-zero quantile. In situations where there's only one non-zero quantile, cut throws an error. Avoid these situations by using a default quantile.

Value

A vector with same length as vec but with columns storing quantiles instead of specificity.

Examples

ctd <- ewceData::ctd()
ctd[[1]]$specificity_quantiles <- apply(ctd[[1]]$specificity, 2,
    FUN = bin_columns_into_quantiles)

NathanSkene/EWCE documentation built on Nov. 3, 2024, 8:16 a.m.