Combines spectral replicates either by averaging (method = "mean") or summing (method = "sum") the intensity values across each row representing a mass-to-charge value in full_mz.

avgSpectra(dat, method = "mean", spectra_cols)

Arguments

dat

The mapped spectral data frame, containing full_mz in the first column.

method

A character string; the method used to combine the spectra. Methods include "sum" and "mean". Default = "mean."

spectra_cols

A character vector; the names of the column in dat containing the intensity data for the spectra-of-interest.

Value

Returns a new column in the input data frame containing the averaged intensity data.

References

https://github.com/wesleyburr/subMaldi

Author

Kristen Yeh <kristenyeh@trentu.ca> Wesley Burr <wesleyburr@trentu.ca> Sophie Castel <sophie.castel@ontariotechu.net>

Examples

## Load sample dataset "Master.rda" data("Master") ## Average blank spectrum 1 and 2 using the method "mean" ex <- avgSpectra(Master, method = "mean", spectra_cols = c("Blank1", "Blank2")) ## Average blank spectrum 1 and 2 using the method "sum" ex <- avgSpectra(Master, method = "sum", spectra_cols = c("Blank1", "Blank2"))