transfIntensity: Transform intensity of 'MassSpectrum' objects

View source: R/transfIntensity.R

transfIntensityR Documentation

Transform intensity of MassSpectrum objects

Description

This function applies user-defined transformations on the intensities of MassSpectrum objects.

Usage

transfIntensity(x, fun = NULL, ...)

Arguments

x

A list of MassSpectrum objects.

fun

Name of an user-defined transformation function or any other pre-defined one in R.

...

Other arguments.

Details

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.

Value

A list of MassSpectrum objects with signal intensities transformed according to fun.

Examples

# 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)



MALDIrppa documentation built on March 29, 2022, 1:05 a.m.