简体   繁体   English

从 R 中给定的 X 轴值中查找 Y 轴的值

[英]Finding value of Y-axis from a given X-axis value in R

Fairly new to R and I'm trying to run analysis of FTIR spectra for my dissertation through the ChemoSpec package. R 的新手,我正在尝试通过 ChemoSpec 包为我的论文运行 FTIR 光谱分析。 In specialist software like Spectragryph (can't access on my own computer, hence using R) it's possible to locate peak values very easily but I can't seem to work out the right way to do it here.在像 Spectragryph 这样的专业软件(无法在我自己的计算机上访问,因此使用 R)中,可以很容易地找到峰值,但我似乎无法在这里找到正确的方法。

This is the formula I'm hoping to perform on all of my spectra:这是我希望在我的所有光谱上执行的公式:

Carbonyl Index (CI) = Absorbance at 1740cm-1 (the maximum of carbonyl peak)/ Absorbance at 1460cm-1 x (the maximum of carbonyl peak)羰基指数 (CI) = 1740cm-1 处的吸光度(羰基峰的最大值)/ 1460cm-1 处的吸光度 x(羰基峰的最大值)

Here is an example of the plot code for the spectra:以下是光谱的绘图代码示例:

## ChemoSpec plot
plotSpectra(HDPE_samples,
main = "48 hr exposure",
which = c(8, 9, 10, 11, 12, 13, 14, 15, 16,
39, 40, 41, 42, 43, 44, 60, 61),
## y axis shows absorbance (%)
yrange = c(0, 0.9),
offset = 0.005,
lab.pos = 2450,
## x axis shows wave numbers (cm-1)
xlim = c(1300, 3000))

For now I'd be happy just to retrieve the absorbance values associated with the wave numbers in the formula if anyone could give me pointers on which functions/packages to look at现在,我很乐意检索与公式中波数相关的吸光度值,如果有人能告诉我要查看哪些函数/包的话

Here is an example of reading data at a specific frequency.这是以特定频率读取数据的示例。

library(ChemoSpec)
#> Loading required package: ChemoSpecUtils

data(metMUD1)
plotSpectra(metMUD1)

# Where is the maximum of signal 1?
which.max(metMUD1$data[1,])
#> [1] 1098

# What is the frequency and intensity at the max value?
metMUD1$freq[1098]
#> [1] 1.340894
metMUD1$data[1, 1098]
#> [1] 0.0680055

Created on 2020-01-15 by the reprex package (v0.3.0)reprex 包(v0.3.0) 于 2020 年 1 月 15 日创建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM