View source: R/transfIntensity.R
transfIntensity | R Documentation |
MassSpectrum
objects
This function applies user-defined transformations on the intensities of MassSpectrum
objects.
transfIntensity(x, fun = NULL, ...)
x |
A list of |
fun |
Name of an user-defined transformation function or any other pre-defined one in R. |
... |
Other arguments. |
This function allows the user to define any sensible function to be applied on signal intensities. For logarithm and square root transformations it is equivalent to transformIntensity
in the MALDIquant package.
A list of MassSpectrum
objects with signal intensities transformed according to fun
.
# Load example data
data(spectra) # list of MassSpectra class objects
# Scale intensities into [0, 1] by dividing by their maximum value
scale.max <- function(x){x/max(x)} # define scaling function
scaled.spectra <- transfIntensity(spectra, fun = scale.max)
# Compute natural logarithm of intensity values (using the pre-defined sqrt R function)
log.spectra <- transfIntensity(spectra, sqrt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.