Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

subset2mspct

Convert 'long' or tidy spectral data into a collection of spectra


Description

Convert a data frame object or spectral object into a collection of spectra object of the corresponding class. For data frames converting numeric columns other than wavelength into individual spct objects.

Usage

subset2mspct(
  x,
  member.class = NULL,
  idx.var = attr(x, "idfactor"),
  drop.idx = TRUE,
  ncol = 1,
  byrow = FALSE,
  ...
)

Arguments

x

a generic_spct object or a derived class, or a data frame

member.class

character string

idx.var

character Name of column containing data to be copied unchanged to each spct object

drop.idx

logical Flag indicating whether to drop or keep idx.var in the collection members.

ncol

integer Number of 'virtual' columns in data

byrow

logical If ncol > 1 how to read in the data

...

additional named arguments passed to the member constructor function.

Value

A collection of spectral objects, each with attributes set if x is a spectral object in long form with metadata attributes. If this object was created by row binding with 'photobiology' 0.9.14 or later then all metadata for each individual spectrum will be preserved, except for comments which are merged.

Note

A non-null value for member.class is mandatory only when x is a data frame.

See Also


photobiology

Photobiological Calculations

v0.10.10
GPL (>= 2)
Authors
Pedro J. Aphalo [aut, cre] (<https://orcid.org/0000-0003-3385-972X>), Titta K. Kotilainen [ctb] (<https://orcid.org/0000-0002-2822-9734>), Glenn Davis [ctb], Agnese Fazio [ctb]
Initial release
2022-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.