Learn R Programming

ChemoSpec (version 2.0-2)

findTMS: Find the TMS/TSP Peak in an NMR Spectrum.

Description

This is a simple function to find the TMS or TSP peak in proton NMR spectrum. It simply finds the rightmost large peak in the spectrum.

Usage

findTMS(x, span, sn, thresh = 0.2, debug = FALSE)

Arguments

Value

The index of the peak believed to be the TMS peak.

Details

The rightmost peak is sought, so the spectrum must be presented in the usual high ppm --> low ppm format. Calls calcSN which will issue warnings when peaks are near the edges of the spectrum.

References

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

Examples

Run this code
# Some test data:
set.seed(99)
vec <- abs(rnorm(100))
vec[12] <- 10
vec[75] <- 31 # create two larger peaks

ans <- findTMS(vec, 20, 5)
ans # index as set above (75)
plot(vec, type = "l")
abline(v = ans, col = "red")

Run the code above in your browser using DataLab