read.opus-method {soil.spec}R Documentation

Reads binary OPUS files containing spectroscopy

Description

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

Usage

 
## 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

## 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)

[Package soil.spec version 0.2.0 Index]