Learn R Programming

spectrolab (version 0.0.18)

as_spectra: Convert matrix or data frame to spectra

Description

Convert matrix or data frame to spectra

Usage

as_spectra(x, name_idx = NULL, meta_idxs = NULL)

Value

spectra object

Arguments

x

matrix or dataframe. Samples are in rows and bands in columns. Any data that are not the spectra themselves (labels or metadata) must have their column index included in `name_idx` or `meta_idxs`.

name_idx

column index with sample names. Defaults to NULL. If NULL or 0, rownames(x) or a sequence of integers will be assigned as names.

meta_idxs

column indices with metadata (not name and not value). Defaults to NULL

Author

Jose Eduardo Meireles

Examples

Run this code
library(spectrolab)
as_spectra(spec_matrix_example, name_idx = 1)

Run the code above in your browser using DataLab