View source: R/sequence_characteristics.R
| scale_to_reference_fun | R Documentation | 
Scale values so that they retain the value of a function applied to reference values
scale_to_reference_fun(x, x_ref, fun, na.rm = FALSE)
x | 
 Numeric vector. Values to scale.  | 
x_ref | 
 Numeric vector. Values from which the reference value is calculated.  | 
fun | 
 A function or character vector identifying a function.  | 
na.rm | 
 A logical value. Argument is passed to   | 
A numeric vector of the same length as x.
scale_to_reference_peak_frequency
x <- c(1:6, 8)
x0 <- c(10, -1)
x0NA <- c(x0, NA)
# Scale to retain value of reference maximum
scale_to_reference_fun(x, x0, fun = max)
# Scale to retain value of reference sum
scale_to_reference_fun(x, x0, fun = sum)
# Scale to retain value of reference mean
scale_to_reference_fun(x, x0, fun = mean)
# Scale to retain value of reference length (mostly nonsensical!)
scale_to_reference_fun(x, x0, fun = length)
# Scale and handle NAs
scale_to_reference_fun(x, x0NA, fun = mean, na.rm = FALSE)
scale_to_reference_fun(x, x0NA, fun = max, na.rm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.