lr_get_spec: Extract spectral data from spectra files

Description Usage Arguments Value See Also Examples

View source: R/get_spec.R

Description

Finds and imports reflectance/transmittance/absorbance data from spectra files in a given location.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
lr_get_spec(
  where = getwd(),
  ext = "txt",
  lim = c(300, 700),
  decimal = ".",
  sep = NULL,
  subdir = FALSE,
  subdir.names = FALSE,
  cores = getOption("mc.cores", 2L),
  ignore.case = TRUE,
  interpolate = TRUE
)

Arguments

where

Folder in which files are located (defaults to current working directory).

ext

File extension to be searched for, without the "." (defaults to txt). You can also use a character vector to specify multiple file extensions.

lim

A vector with two numbers determining the wavelength limits to be considered (defaults to c(300, 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).

cores

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

ignore.case

Should the extension search be case insensitive? (defaults to TRUE)

interpolate

Boolean indicated whether spectral data should be interpolated and pruned at every nanometer. Note that this option can only work if all input data samples the same wavelengths. Defaults to TRUE.

Value

A data.frame, containing the wavelengths in the first column and individual imported spectral files in the subsequent columns.

See Also

pavo::getspec()

Examples

1
lr_get_spec(system.file("testdata", package = "lightr"), ext = "jdx")

Bisaloo/lightr documentation built on Jan. 21, 2020, 4:10 p.m.