rspec2mspct: Convert "pavo::rspec" objects
Description
Convert between 'pavo::rspec' objects containing spectral reflectance data
into spectral objects (xxxx_spct, xxxx_mspct) as defined in package
'photobiology'.
Usage
rspec2mspct(x, member.class = "reflector_spct", spct.data.var = "Rpc", multiplier = 1, ...)
rspec2spct(x, multiplier = 1, ...)
Arguments
member.class
character One of the spectrum classes defined in package
'photobiology'.
spct.data.var
character The name to be used for the 'spc' data when
constructing the spectral objects.
multiplier
numeric A multiplier to be applied to the 'rspc' data to do
unit or scale conversion.
Warning!
Always check the sanity of the imported or exported data
values, as guessing is needed when matching the different classes, and the
functions defined here are NOT guaranteed to return valid data wihtout help
from the user through optional function arguments.Examples
Run this code
library(pavo)
data(sicalis)
sicalis.mspct <- rspec2mspct(sicalis)
class(sicalis.mspct)
data(teal)
teal.spct <- rspec2spct(teal)
class(teal.spct)
levels(teal.spct[["spct.idx"]])
angles <- seq(from = 15, to = 75, by = 5) # from teal's documentation
teal.spct[["angle"]] <- angles[as.numeric(teal.spct[["spct.idx"]])]
teal.spct
Run the code above in your browser using DataLab