Skip to contents

*️⃣ hyperSpec

Usage

to_hyperSpec(...)

Arguments

...

Arguments passed on to hyperSpec::hyperSpec

spc

(matrix or convertible to matrix)
A spectra matrix with spectra in rows and wavelength intensities in columns.

The spc does not need to be an R matrix, but it must be an object convertible to a matrix via I(as.matrix(spc)).

data

(data.frame)
A data.frame with extra (non-spectroscopic) data in columns. The data frame may also contain a special column spc with a matrix of spectroscopic data. (Such a single column that contains a matrix can be created with data.frame(spc = I(as.matrix(spc))). However, it is usually more convenient to provide the spectra via the spc argument.)

wavelength

(numeric vector)
The wavelengths corresponding to the columns of spc.

If no wavelengths are given, an appropriate vector is derived from the column names of data$spc. If this is not possible, 1:ncol(data$spc) is used instead.

labels

A named list:

  • list's element names should contain one or more names of data columns as well as the special name .wavelength for wavelengths.

  • list's element values should contain the labels for the indicated names, usually in the form of character strings or plotmath expressions. (The labels should be given in a form ready for the text-drawing functions, see grDevices::plotmath()).

If label is not given, a list containing NULL for each of the columns of data and wavelength is used.

gc

(logical)
Use garbage collection. If the option gc is set to TRUE, the initialization will have frequent calls to base::gc(), which can help avoid swapping or running out of memory. The default value of gc can be set via hy_set_options().

Value

A hyperSpec::hyperSpec object.