Learn R Programming

ChemoSpec (version 6.1.10)

averageReplicates: 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)

Value

An object of S3 class Spectra.

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.

Author

Bryan A. Hanson (DePauw University).

Examples

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

Run the code above in your browser using DataLab