collect2mspct: Form a new collection

View source: R/spct.utils.r

collect2mspctR Documentation

Form a new collection

Description

Form a collection of spectra from separate objects in the parent frame of the call.

Usage

collect2mspct(
  .list = NULL,
  pattern = "*\\.spct$",
  collection.class = NULL,
  ...
)

Arguments

.list

list of R objects

pattern

character an optional regular expression, ignored if .list is not NULL.

collection.class

character vector

...

additional named arguments passed down to the collection constructor.

Details

This is a convenience function that simplifies the creation of collections from existing objects of class generic_spct or a derived class. A list of objects con be passed as argument, or a search pattern. If a list is passed, no search is done. If collection.class is NULL, then all objects of class generic_spct or of a class derived from it are added to the collection. If objects of only one derived class are to be collected this class or that of the matching collection should be passed as argument to collection.class. Objects of other R classes are silently discarded, which simplifies the specification of search patterns. By default, i.e., if collection.class is NULL, if all the objects collected belong to the same class then the corresponding collection class will be returned, otherwise a generic_mspct object with heterogeneous members will be returned. To force the return of a generic_mspct even when the collected spectra all belong to the same class, pass generic_mspct as argument to collection.class. If the argument to collection.class is a vector containing two of more class names, only the matching spectra will be collected, and a generic_mspct will be returned. The returned object is created with the constructor for the class, and validated.

Value

By default a collection of spectra.

See Also

Other experimental utility functions: drop_user_cols(), thin_wl(), uncollect2spct()

Examples

collect2mspct() # returns empty generic_mspct object

sun1.spct <- sun.spct
sun2.spct <- sun.spct
kk.spct <- 10:30 # ignored
collect2mspct()
collect2mspct(collection.class = "generic_mspct")

pet1.spct <- polyester.spct
collect2mspct()
collect2mspct(collection.class = "source_mspct")
collect2mspct(collection.class = "filter_mspct")
collect2mspct(collection.class = "response_mspct")


photobiology documentation built on Oct. 21, 2023, 1:06 a.m.