log2t: Logarithm With Thresholding

View source: R/utils.R

log2tR Documentation

Logarithm With Thresholding

Description

Safe log and log2 calculations where values within [0, thresh) are thresholded to thresh prior to the transformation.

Usage

logt(x, thresh = 0.5)
log2t(x, thresh = 0.5)

Arguments

x

a numeric or complex vector.

thresh

a positive number specifying the threshold.

Details

For non-negative elements in x, calculates log(pmax(x, thresh)) or log2(pmax(x, thresh)).

Value

A vector of the same length as x containing the transformed values.

Author(s)

Patrick Aboyoun

See Also

log, log2

Examples

logt(0:8)
identical(logt(0:8), log(c(0.5, 1:8)))

log2t(0:8)
identical(log2t(0:8), log2(c(0.5, 1:8)))

Nanostring-Biostats/NanoStringNCTools documentation built on Dec. 18, 2024, 1:24 a.m.