0

我尝试使用 ChemoSpec files2SpectraObect 命令加载 NIR 光谱。数据直接来自 *csv 文件,但我收到以下错误消息:

files2SpectraObject(gr.crit = c("BP","TP"), + gr.cols = c("red3","dodgerblue4"), + freq.unit = "波长", + int.unit = "反射率" , + descrip = "Avenue samples", + format = "csv", + out.file = "NIR.ave")

Converting integer frequency values to numeric
*** There seem to be one or more problems with these spectra!
Error in chkSpectra(spectra) : 
  Sorry, we can't continue this way: It's not me, it's you!
In addition: Warning message:
In chkSpectra(spectra) : The frequency data appear to be corrupt

setwd("W:\SciFac\OrgGeochem\Staff\Darren Beriro\PhD\R_PhD\MIR 光谱文件") files2SpectraObject(gr.crit = c("bp","tp"), + gr.cols = c("red3 ","dodgerblue4"), + freq.unit = "Wavelenth", + int.unit = "Reflectance", + descrip = "Avenue samples", + format = "csv", + out.file = "MIR.ave" )

我检查了用于创建 csv 文件的数据框,并且波数是一个数字变量。数据范围是从 350 到 2500 的整数。我以相同的方式加载了 FTIR / MIR 数据 - 频率值包括小数位,并且这些文件可以正常加载。

4

2 回答 2

1

好的,我只是逐行浏览了 files2SpectraObject 和 chkSpectra 中的代码,这是在第一个函数内部调用的函数。我看到了两个问题。

如果频率是整数,chkSpectra 将发出警告并停止函数。我认为您无法在数据中解决此问题。这是粗略的,但我推荐这个修复。

修复(chkSpectra)

删除运行 stop() 的第 81 行

修复(files2SpectraObject)

在第 171 行,使用相同的参数将 saveObject() 更改为 save()。这似乎是一个错误或一个不在我没有的通用包中的功能。

使用 fix 只会临时修复功能,因此除非您保存工作区,否则每次加载 csv 时都可能需要重新运行此修复程序

于 2015-01-16T23:52:49.827 回答
0

检查您的分隔符和小数点符号。尝试使用“,”作为十进制和“;”的 csv2 分隔器。

于 2014-09-15T21:34:18.247 回答