Description Usage Arguments Value Author(s) Examples
View source: R/averageSpectra.R
This function accepts spectra, averages them, and returns the results. This
function is a simple wrapper for the aggregate()
function, made to work
smoothly with spectra.
1 | averageSpectra(spec = NULL, by = NULL)
|
spec |
An object of class |
by |
Either (i) a vector of length |
Returns an object of class spectra.matrix
.
Daniel M Griffith
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
data(shootout)
by_vector <- gsub(pattern = "_.*",replacement = "",
x = row.names(shootout_scans)) # average everything to one scan
mean_scans <- averageSpectra(spec = shootout_scans, by = by_vector)
#or...
mean_scans <- averageSpectra(spec = shootout_scans, by = 3)
# average scans in groups of 3
par(mfrow=c(1,2))
plot(shootout_scans)
plot(mean_scans)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.