importSpectra {andurinha} | R Documentation |
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.
importSpectra(path, sep = ";")
path |
A character vector with the full path to the data directory; by
default corresponds to the working directory, |
sep |
The field separator character; by default sep = ";". |
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).
findPeaks
, gOverview
and
plotPeaks
# 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(), "/"), ";")