read.spc: Reads spectral spc-files into R

Description Usage Arguments Details Value Author(s) Examples


read.spc reads binary spectral spc-files from a folder into R. The spectra can be made compatible (see details in make.comp) either to the first sample wavebands or to the standard wavebands of the ICRAF spectral lab. Information from the scanning method is gathered to check on spectral comparability. The default has been set to ICRAF spectral bands.


read.spc(loa = "", path = "", sav = "F", out = "Sm", = "workspace", wn = "first")



a character giving the path name where the spc-files are stored. If "" (default), the spc-files are stored in the current working directory.


a character giving the path name where the function output shall be saved.


a logical value indicating whether the function output shall be saved.


a character giving the function output name, in case sav is "T".

a character vector indicating the format of the saved output. "workspace" saves the function output named with out as workspace. "csv.file" saves the function output as csv-file.


a character giving the way how the samples should be made compatible. If "first", all spectra are made compatible to the first read sample. if "ICRAF", all spectra are made compatible to the standard wavebands of the ICRAF spectral lab.


Spectra from the near- and mid-infrared range can be read. In case the spc-files saved in loa comprise both ranges the function output is given separate for each range.

The function allows to read only spectra in one go, when they have the same material (e.g. soil or plant), were scanned with the same resolution and have the same zero filling. If there are still small differences in the number of wavebands, the spectra are made compatible depending on the argument wn. In case spectra with different materials shall be read, the user has to decide the material via graphical interface.


read.spc returns a list with class "read.spc" containing the following components:


a numerical matrix containing the read spectra.


a data frame containing some scanning method details.


a data frame merging additional.information and spectra; columns 2 to 4 from the additional.information table are excluded to conform to the existing structure of library in existence


Andrew Sila and Thomas Terhoeven-Urselmans


## Not run: mir<-read.spc(loa="D:/AfSIS/spc files",sav="F",wn="ICRAF")
## Not run: raw<-mir$raw.spectra #To extract the object with both additional.information and spectra
## Not run: raw[1:4,1:4] #This gives a snapshot of the first four rows and the first columns

Example output

soil.spec version 2.1.4 (2014-12-17)

soil.spec documentation built on May 2, 2019, 6:08 p.m.