Converts data frames or matrices containing spectral data to rspec object

as.rspec(object, whichwl = NULL, interp = TRUE, lim = NULL)

is.rspec(object)

Arguments

object

(required) a data frame or matrix containing spectra to process.

whichwl

specifies which column contains wavelengths. If NULL (default), function searches for column containing equally spaced numbers and sets it as wavelengths "wl". If no wavelengths are found or whichwl is not given, returns arbitrary index values.

interp

whether to interpolate wavelengths in 1-nm bins (defaults to TRUE).

lim

vector specifying wavelength range to interpolate over (e.g., c(300, 700)).

Value

an object of class rspec for use in further pavo functions

a logical value indicating whether the object is of class rspec

Examples

# NOT RUN {
# Generate some fake reflectance data
fakedat <- data.frame(wl= c(300:700), refl1 = rnorm(401), refl2 = rnorm(401))
head(fakedat)

# Determine if is rspec object
is.rspec(fakedat)

# Convert to rspec object
fakedat2 <- as.rspec(fakedat)
is.rspec(fakedat2)
head(fakedat2)
# }