Learn R Programming

spectrolab (version 0.0.18)

names<-.spectra: Set spectra sample names

Description

names assigns sample names to lhs

Usage

# S3 method for spectra
names(x) <- value

Value

nothing. called for its side effect.

Arguments

x

spectra object (lhs)

value

values to be assigned (rhs)

Author

Jose Eduardo Meireles

Details

Sample names must not be coercible to numeric. That is, names such as "1" and "153.44" are invalid even if they are encoded as character. names will add the prefix "spec_" to any element of value that is coercible to numeric.

Examples

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

Run the code above in your browser using DataLab