Learn R Programming

OpenSpecy (version 1.5.3)

read_any: Read spectral data from multiple files

Description

Wrapper functions for reading files in batch.

Usage

read_any(file, c_spec = T, c_spec_args = list(range = NULL, res = NULL), ...)

read_many(file, ...)

read_zip(file, ...)

Value

All read_*() functions return OpenSpecy objects if a single spectrum or map is provided, otherwise they provide a list of OpenSpecy objects.

Arguments

file

file to be read from or written to.

c_spec

logical, if multiple spectra should be concatenated or not. Multiple spectra will return a list if this is false.

c_spec_args

list of arguments passed to c_spec()

...

further arguments passed to the submethods.

Author

Zacharias Steinmetz, Win Cowger

Details

read_any() provides a single function to quickly read in any of the supported formats, it assumes that the file extension will tell it how to process the spectra. read_zip() provides functionality for reading in spectral map files with ENVI file format or as individual files in a zip folder. If individual files, spectra are concatenated. read_many() provides functionality for reading multiple files in a character vector and will return a list.

See Also

read_spec() for submethods. c_spec() for combining lists of Open Specys.

Examples

Run this code
data.table::setDTthreads(2)
read_extdata("raman_hdpe.csv") |> read_any()
read_extdata("ftir_ldpe_soil.asp") |> read_any()
read_extdata("testdata_zipped.zip") |> read_many()
read_extdata("CA_tiny_map.zip") |> read_many()

Run the code above in your browser using DataLab