r基线校正

发布于 2025-01-26 14:33:47 字数 800 浏览 1 评论 0原文

我对编码和R的新手相对较新。我正在尝试对我拥有的拉曼数据进行基线校正。我的数据分为两行,一个x和y轴。我相信数据需要是矩阵,因此它不起作用的原因?我试图遵循各种指南以使其正常工作。这是代码。请尝试帮助我出错的地方。 SETWD链接到正确的位置,但已删除。

library(baseline)
library(inspectr)
library(spectrolab)

setwd("")
exam = read.delim("top.txt", header=F)
mattt = as.matrix(exam)
bc.irls = baseline(mattt["spectra"][1,, drop=FALSE])
#bl3 <- baseline(spectra(mattt), method = 'irls')
plot(bc.irls)

我关注的原始方法

# Load data 
data(milk) 
# The baseline() function is an S4 wrapper for all the different 
# baseline correction methods. The default correction method 
# is IRLS. Data must be organized as row vectors in a matrix 
# or data.frame. 
bc.irls <- baseline(milk$spectra[1,, drop=FALSE]) 
## Not run: 
# Computationally heavy 
plot(bc.irls)

谢谢!

I am relatively new to coding and R in general. I am trying to do baseline correction for Raman data I have. My data is in two rows, an x and y-axis. I believe that the data needs to be a matrix and thus the reason why it is not working? I have tried to follow various guides to get it working. This is the code. Please try and help me where I am going wrong. The setwd is linked to the correct place but have removed.

library(baseline)
library(inspectr)
library(spectrolab)

setwd("")
exam = read.delim("top.txt", header=F)
mattt = as.matrix(exam)
bc.irls = baseline(mattt["spectra"][1,, drop=FALSE])
#bl3 <- baseline(spectra(mattt), method = 'irls')
plot(bc.irls)

The original method I am following

# Load data 
data(milk) 
# The baseline() function is an S4 wrapper for all the different 
# baseline correction methods. The default correction method 
# is IRLS. Data must be organized as row vectors in a matrix 
# or data.frame. 
bc.irls <- baseline(milk$spectra[1,, drop=FALSE]) 
## Not run: 
# Computationally heavy 
plot(bc.irls)

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文