averageReplicates: Average Replicates in a Spectra Object

View source: R/averageReplicates.R

averageReplicatesR Documentation

Average Replicates in a Spectra Object

Description

Average the replicates in a Spectra object and return a new Spectra object with fewer samples. One should probably not do this until each individual sample has been visualized for quality control, in case it is a potential outlier.

Usage

averageReplicates(spectra, uniq)

Arguments

spectra

An object of S3 class Spectra().

uniq

Character. A character vector containing strings representing unique sample identifiers. The sample names will be searched for these strings, and all samples matching a given string will be averaged and put into a new Spectra object. For example, consider the case where samples are named S_1_01, S_1_02, ..., S_2_01, S_2_02, ... where _01 and so forth signifies replicates of a particular sample. With uniq = c("S_1", "S_2") all S_1 replicates will be averaged and all S_2 replicates will be averaged. N.B. the strings will be used as regex pattern and grepped.

Value

An object of S3 class Spectra.

Author(s)

Bryan A. Hanson (DePauw University).

Examples

data(SrE.IR)
averaged <- averageReplicates(SrE.IR, uniq = c("EPO", "OO", "adSrE", "pSrE"))
sumSpectra(SrE.IR)
sumSpectra(averaged)


bryanhanson/ChemoSpec documentation built on Feb. 10, 2024, 1:17 a.m.