log2signed: log2 transformation with directionality

log2signedR Documentation

log2 transformation with directionality

Description

log2 transformation with directionality

Usage

log2signed(x, offset = 1, base = 2, ...)

Arguments

x

numeric vector

offset

numeric value added to the absolute values of x prior to applying the log transformation.

base

numeric value indicating the logarithmic base, by default 2 in order to apply base::log2().

...

additional arguments are ignored.

Details

This function applies a log2 transformation but maintains the sign of the input data, allowing for log2 transformation of negative values.

The method applies an offset to the absolute value abs(x), in order to handle values between zero and 1, then applies log2 transformation, then multiplies by the original sign from sign(x).

The argument offset is used to adjust values, for example offset=1 will apply log2 transformation log2(1 + x), except using the absolute value of x. This method allows for positive and negative input data to contain values between 0 and 1, and between -1 and 0.

This function could be described as applying a log2 transformation of the "magnitude" of values in x, while maintaining the positive or negative directionality.

If any abs(x) are less than offset this function will raise an error.

Value

numeric vector of log-transformed magnitudes.

See Also

Other jam practical functions: breakDensity(), checkLightMode(), check_pkg_installed(), colNum2excelName(), color_dither(), diff_functions(), exp2signed(), fileInfo(), fixYellow(), getAxisLabel(), handleArgsText(), heads(), isFALSEV(), isTRUEV(), jamba, jargs(), kable_coloring(), lldf(), make_html_styles(), make_styles(), match_unique(), mergeAllXY(), middle(), minorLogTicks(), newestFile(), printDebug(), renameColumn(), rmInfinite(), rmNAs(), rmNA(), rmNULL(), sclass(), sdim(), setPrompt()

Examples

x <- c(-100:100)/10;
log2signed(x);
plot(x=x, y=log2signed(x), xlab="x", ylab="log2signed(x)")


jmw86069/jamba documentation built on March 26, 2024, 5:26 a.m.