View source: R/spct-wide2long.r
spct_wide2long | R Documentation |
Convert spectrum from wide to long form
spct_wide2long(
spct,
fixed.cols = "w.length",
idfactor = "spct.idx",
rm.spct.class = FALSE,
...
)
spct |
An object with spectral data. |
fixed.cols |
character Names of variables that should be copied unchanged for each spectrum. |
idfactor |
character The name of the factor to be added to the long-form object and used to store the original name of the columns as an index to the different spectra. |
rm.spct.class |
logical If true the returned object is a data frame. |
... |
Currently ignored. |
Only objects of classes raw_spct, cps_spct, and object_spct normally contain
multiple columns of spectral data. These are supported as well as
generic_spct. Is the wide spectra contain multiple spectra in long form,
the original idfactor
is preserved.
Spectra that are already in long form, if passed as argument, are returned unchanged.
Because the classes defined for spectra have a well defined format, and known column names we can define a rather simple function for this operation.
An object of the same class as spct
or a data.frame
with derived classes removed.
spct_wide2long(white_led.raw_spct)
spct_wide2long(white_led.cps_spct)
spct_wide2long(Ler_leaf.spct)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.