Learn R Programming

photobiologyInOut (version 0.4.9)

mat2mspct: Convert a matrix into a collection of spectra

Description

Convert an R object of class matrix into a generic_mspct or a derived class.

Usage

mat2mspct(x, w.length, member.class, spct.data.var, multiplier = 1, byrow = NULL, spct.names = "spct_", ...)

Arguments

x
matrix object.
w.length
numeric A vector of walength values sorted in strictly ascending order (nm).
member.class
character The name of the class of the individual spectra to be constructed.
spct.data.var
character The name of the variable that will contain the spectral data. This indicates what physical quantity is stored in the matrix and the units of expression used.
multiplier
numeric A multiplier to be applied to the values in x to do unit or scale conversion.
byrow
logical Flag indicating whether each spectrum is stored in a row or a column of the matrix. By default this value is set based on the length of w.length and the dimensions of x.
spct.names
character Vector of names to be assigned to collection members, either of length 1, or with length equal to the number of spectra.
...
other arguments passed to the constructor of collection members.

Examples

Run this code

x <- matrix(1:100, ncol = 2)
wl <- (301:350)
z <- mat2mspct(x, wl, "filter_spct", "Tpc")

x <- matrix(1:100, nrow = 2, byrow = TRUE)
wl <- (301:350)
z <- mat2mspct(x, wl, "filter_spct", "Tpc", byrow = TRUE, spct.name = c("A", "B"))

Run the code above in your browser using DataLab