importSpectra: importSpectra

View source: R/importSpectra.R

importSpectraR Documentation

importSpectra

Description

In case you have your spectra in separated files (.csv) this function imports and binds them in a single data frame. The files directory must contain only the samples files.

Usage

importSpectra(path, sep = ";")

Arguments

path

A character vector with the full path to the data directory; by default corresponds to the working directory, getwd.

sep

The field separator character; by default sep = ";".

Value

A data frame with the structure:

  • First column (WN): wave numbers of the spectra.

  • 1-n: samples spectra (the column names correspond to the files names).

See Also

findPeaks, gOverview and plotPeaks

Examples

# Create an empty directory
# Now create some spectra separate files
A <- andurinhaData[, 1:2]
B <- andurinhaData[, c(1, 3)]
C <- andurinhaData[, c(1, 4)]

MASS::write.matrix(A, file = tempfile(pattern = "A.csv"), sep = ";")
MASS::write.matrix(A, file = tempfile(pattern = "B.csv"), sep = ";")
MASS::write.matrix(A, file = tempfile(pattern = "C.csv"), sep = ";")

# Try
importSpectra(path = paste0(tempdir(), "/"), ";")


noemiallefs/andurinha documentation built on Sept. 1, 2023, 2:31 a.m.