get_numeric_transform: Get appropriate numeric transformation function

get_numeric_transformR Documentation

Get appropriate numeric transformation function

Description

Get appropriate numeric transformation function

Usage

get_numeric_transform(transform, ...)

Arguments

transform

character string or function, or list that may contain character string or function.

...

additional arguments are ignored.

Details

This function recognizes numeric transformation functions by name, or searches the attached R package environments for a matching function by name.

Recognized transform names:

  • "none" or "linear" returns the data without change

  • "log2signed" applies jamba::log2signed(), defined as log2(1+x) transform to the absolute value, then multiplies by the original sign(x)

  • "exp2signed" applies the inverse of "log2signed", which exponentiates numeric values which were previously transformed with log2(1+x). Note that value=0 when exponentiated becomes +1

  • "sqrt" applies square root transform, equivalent to sqrt()

  • "cubert" applies cube root x^(1/3)

  • "qrt" applies fourth root x^(1/4)

  • "frt" or "fthrt" applies fifth root x^(1/5)

  • "square" applies x^2 to absolute value, multiplied by the sign(x)

  • "cube" applies x^3;

Any other character name is used to find a function with the same name, and if the function is found it is used. The function is expected to take input x and return corresponding output with the same length as the input. A function such as max() does not fit this criteria, but a function such as log2() is acceptable.

Value

function or NULL when no matching function is found, or list is returned when the input transform has multiple values.

See Also

Other jam utility functions: cardinality(), color_complement(), convert_PD_df_to_SE(), convert_imputed_assays_to_na(), curate_se_colData(), curate_to_df_by_pattern(), design2layout(), handle_df_args(), merge_proteomics_se(), nmat_summary(), nmatlist_summary(), rmd_tab_iterator(), rowNormScale(), summit_from_vector()

Examples

get_numeric_transform("log2signed")

transform_list <- get_numeric_transform(
   c("none",
   "log2signed",
   log2,
   sqrt));
jamba::sdim(transform_list);

x <- jamba::nameVector(0:16);
transform_list[[1]](x)

transform_list[[2]](x)


jmw86069/platjam documentation built on Sept. 26, 2024, 3:31 p.m.