getspec: Import spectra files

Description Usage Arguments Value Author(s) References Examples

View source: R/getspec.R

Description

Finds and imports spectra files from a folder. Currently works for reflectance files generated in Ocean Optics SpectraSuite (USB2000, USB4000 and Jaz spectrometers), CRAIC software (after exporting) and Avantes (after exporting).

Usage

1
2
3
getspec(where = getwd(), ext = "txt", lim = c(300, 700), decimal = ".",
  sep = NULL, subdir = FALSE, subdir.names = FALSE, fast = FALSE,
  cores = getOption("mc.cores", 2L))

Arguments

where

(required) folder in which files are located.

ext

file extension to be searched for, without the "." (defaults to "txt").

lim

a vector with two numbers determining the wavelength limits to be considered (defaults to 300 and 700).

decimal

character to be used to identify decimal plates (defaults to ".").

sep

column delimiting characters to be considered in addition to the default (which are: tab, space, and ";")

subdir

should subdirectories within the where folder be included in the search? (defaults to FALSE).

subdir.names

should subdirectory path be included in the name of the spectra? (defaults to FALSE).

fast

logical. if TRUE, will try a fast algorithm that assumes all spectra were produced using the same software configuration (defaults to FALSE).

cores

Number of cores to be used. If greater than 1, import will use parallel processing (not available in Windows).

Value

A data frame, of class rspec, containing individual imported spectral files as columns. Reflectance values are interpolated to the nearest wavelength integer.

Author(s)

Rafael Maia [email protected]

References

Montgomerie R (2006) Analyzing colors. In: Hill G, McGraw K (eds) Bird coloration. Harvard University Press, Cambridge, pp 90-147.

Examples

1
2
3
4
## Not run: 
getspec('examplespec/', lim = c(400, 900))	
getspec('examplespec/', ext = 'ttt')
## End(Not run)

pavo documentation built on Oct. 3, 2017, 1:04 a.m.