A wrapper function to initialize a new hyperSpec object. More information in hyperSpec initialize.

hyperSpec(spc = NULL, data = NULL, wavelength = NULL, labels = NULL)

Arguments

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 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 single column that contains matrix can be created with data.frame(spc = I(as.matrix(spc))). However, it will usually be more convenient if the spectra are given via argument spc.)

wavelength

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

If no wavelengths are given, an appropriate vector is derived from the column 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 containing one or more names of data columns as well as special name .wavelength for wavelengths ).

  • list's element values should contain the labels for the indicated names usually either in a for 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.

Value

A hyperSpec object.