read.opus: Reads binary OPUS files containing spectroscopy

Description Usage Arguments Details Note Note Author(s) References See Also Examples

View source: R/read.opus.R

Description

Reads binary OPUS files containing infrared, near infrared and Raman spectroscopy measurements (absorbances) and generates an object of class "SpectraPoints".

Usage

1
2
3
4
5
6
7
8
 
## S4 method for signature 'character'
read.opus(file.name, sp = NULL,  
    codes = c("ZFF","RES","SNM","DAT","LWN","FXV","LXV","NPT","MXY","MNY","END","TIM"), 
    plot.spectra = FALSE, print.progress = FALSE, speclib = "ICRAF",
    signif.digit = get("signif.digit", spec.opts), MID, st.wavenumbers = wavenumbers)
## S4 method for signature 'list'
read.opus(file.name, ...)

Arguments

file.name

"character"; file name with extension

sp

"SpatialPoints"; optional spatial object with coordinates of points with same sample ID's in the coordinates slot row names

codes

"character"; default OPUS codes

plot.spectra

"logical"; specifies whether to plot spectral curves every time a new sample is loaded

print.progress

"logical"; specifies whether to print progress

signif.digit

"integer"; number of significant digits

speclib

"character"; specifies which spectral library to base data points

MID

"character"; metadata ID

st.wavenumbers

"data.frame"; standard wavenumbers with band names and upper / lower limits (usually predefined)

...

other optional arguments

Details

This function will read OPUS files from Bruker Optics' Alpha, MPA and Tensor-27 spectrometers. A choice for the type of spectral library to be created from the data tables created is done. To match data points to ICRAF's spectral library set speclib = "ICRAF", otherwise to create own spectral library based on OPUS files being converted set speclib="New".

Note

Setting speclib = "New" may produce spectra with non-overlapping points brought about by slight drifts on the equipement and combinining with different columns can cause problems. If one chooses to create their own library, stable data points observed over time should be used to align all future scans.

Note

Reading long list of binary files can be time and memory consuming.

Author(s)

Andrew Sila and Tomislav Hengl

References

See Also

SpectraPoints-class, predict.SpectraPoints, wavenumbers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Original binary Opus files:
pth = system.file(package = "soil.spec")
lst <- as.list(list.files(path=pth, pattern="*.0$", full.names=TRUE))
file.info(lst[[1]])
xx <- read.opus(lst)
str(xx)
## predict pH
data(m.PHIHOX)
s.xx <- predict(xx, model = m.PHIHOX, prob. = .75)
s.xx
## Note: duplicate samples get unique name by default

## predict all standard soil properties:
nm <- get("attributes", spec.opts)
nm
pr.lst <- NULL
for(k in 1:length(nm)){
  data(list=paste("m.", nm[k], sep=""))
  try( pr.lst[[k]] <- predict(xx, variable=nm[k], 
  model = get(paste("m.", nm[k], sep="")), prob. = .75) )
}
pr <- do.call(cbind, pr.lst)
str(pr)

soil.spec documentation built on May 30, 2017, 2:19 a.m.