Converts a list of MassPeaks objects into a matrix.
Converts a list of MassPeaks objects into a matrix.
This function converts a list of MassPeaks objects into a matrix.
intensityMatrix(peaks, spectra)
Arguments
peaks: list, list of MassPeaks objects.
spectra: list, list of MassSpectrum objects. If a peak is missing the corresponding intensity value of the spectrum is used. If spectra is missing NA is used instead.
Details
peaks have to be binned by binPeaks before calling intensityMatrix.
Returns
Returns a matrix containing intensities of all MassPeaks objects of peaks and interpolated intensity values for missing peaks if spectra was given or NA
otherwise.
The matrix has length(peaks) rows (one row for each sample) and length(unique(mass)) columns. There is an additional attribute "mass" that stores the mass values.