Learn R Programming

ChemoSpec (version 2.0-2)

chkSpectra: Verify the Integrity of a Spectra Object

Description

Utility function to verify that the structure of a "Spectra" object (an instance of an S3 object) is internally consistent. Rather than directly manipulating a "Spectra" object, one should manipulate it via removeFreq or removeSample. Should not see much direct use by users.

Usage

chkSpectra(spectra, confirm = FALSE)

Arguments

Value

None; messages will be printed at the console if there is a problem.

Rdversion

1.1

Details

This function is similar in spirit to validObject in the S4 world. When used at the console, and the object is OK, no message is written unless confirm = TRUE. At the console, if there is a problem, messages are issued regardless of the value of confirm. When used in a function, this function is silent (assuming confirm = FALSE) unless there is a problem.

References

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

Examples

Run this code
data(CuticleIR)
chkSpectra(CuticleIR, confirm = TRUE) # OK
# What's next works, but is the wrong way to manipulate a "Spectra" object.
# Use removeSample instead.
remove <- c(20:40) 
CuticleIR$freq <- CuticleIR$freq[-remove]
chkSpectra(CuticleIR, confirm = TRUE) # not OK, you didn't listen to me!

Run the code above in your browser using DataLab