Learn R Programming

ChemoSpec (version 1.48-4)

removeSample: Remove Samples from a Spectra Object

Description

Removes specified samples from a "Spectra" object.

Usage

removeSample(spectra, rem.sam)

Arguments

spectra
An object of S3 class "Spectra"
rem.sam
Either an integer vector specifying the samples to be removed, or a character vector giving the sample names to be removed.

Value

  • A modified object of S3 class "Spectra".

Details

If rem.sam is a character vector, the sample names are grepped for the corresponding values. Remember that the grepping process is greedy, i.e. grepping for "XY" find not only "XY" but also "XYZ". Unused levels in $groups are dropped.

References

http://academic.depauw.edu/~hanson/ChemoSpec/ChemoSpec.html

See Also

removeFreq to remove selected frequencies from a "Spectra" object.

Examples

Run this code
data(CuticleIR)
new1 <- removeSample(CuticleIR, rem.sam = 20)
# removes the 20th spectrum/sample
new2 <- removeSample(CuticleIR, rem.sam = "GE")
# removes all samples whose name contains "GE"
new3 <- removeSample(CuticleIR, rem.sam = "GE10")
# removes one spectrum/sample with this exact name.

Run the code above in your browser using DataLab