Learn R Programming

pavo (version 0.3-1)

as.rspec: Convert data to an rspec object

Description

Converts data frames or matrices containing spectral data to rspec object

Usage

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 ind
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

Run this code
# Generate some fake reflectance data
fakedat <- data.frame(refl1 = rnorm(401), refl2 = rnorm(401), wavelength = c(300:700))
head(fakedat)

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

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

Run the code above in your browser using DataLab