Learn R Programming

spectrolab (version 0.0.18)

read_spectra: Read files from various formats into `spectra`

Description

Read files from various formats into `spectra`

Usage

read_spectra(
  path,
  format = NULL,
  type = "target_reflectance",
  extract_metadata = FALSE,
  exclude_if_matches = NULL,
  ignore_extension = FALSE
)

Value

a single `spectra` or a list of `spectra` (in case files have incompatible band number or bands values)

Arguments

path

Path to directory or input files.

format

File format. Defaults to NULL so spectrolab tries to guess it from the file name. Alternatively, use "asd" for ASD; "sig" for SVC (Spectra Vista); or "sed" for PSR (Spectral Evolution)

type

Data type to read. "target_reflectance", "target_radiance", or "reference_radiance". Defaults to "target_reflectance".

extract_metadata

Boolean. Defaults to FALSE. Only implemented for the Spectra Vista (.sig) and Spectral Evolution (.sed) file types.

exclude_if_matches

excludes files that match this regular expression. Example: "BAD"

ignore_extension

Boolean. If TRUE, the parser will try to read every file in path regardless of the expected extension.

Author

Jose Eduardo Meireles

Examples

Run this code
library(spectrolab)
dir_path = system.file("extdata", "Acer_example", package = "spectrolab")

spec     = read_spectra(path = dir_path, format = "sig")

Run the code above in your browser using DataLab