Learn R Programming

hyperSpec (version 0.100.2)

as.hyperSpec: as.hyperSpec: convenience conversion functions

Description

These functions are shortcuts to convert other objects into hypeSpec objects.

Usage

as.hyperSpec(X, ...)

# S4 method for matrix as.hyperSpec(X, wl = guess.wavelength(colnames(X)), ...)

# S4 method for data.frame as.hyperSpec( X, spc = NULL, wl = guess.wavelength(spc), labels = attr(X, "labels"), ... )

Value

hyperSpec object

Arguments

X

the object to convert. A matrix is assumed to contain the spectra matrix, a data.frame is assumed to contain extra data.

...

additional parameters that should be handed over to new ("hyperSpec") (initialize)

wl

wavelength vector. Defaults to guessing from the column names in X

spc

spectra matrix

labels

list with labels

See Also

initialize

Examples

Run this code
tmp <- data.frame(flu [[,, 400 ~ 410]])
(wl <- colnames (tmp))
guess.wavelength (wl)

Run the code above in your browser using DataLab