R: Convert a 'wide' or untidy data frame into a collection of...

split2mspct {photobiology} | R Documentation

## Convert a 'wide' or untidy data frame into a collection of spectra

### Description

Convert a data frame object into a "multi spectrum" object by constructing a an object of a multi-spct class, converting numeric columns other than wavelength into individual spct objects.

### Usage

    split2mspct(x, member.class = NULL, spct.data.var = NULL,
      w.length.var = "w.length", idx.var = NULL, ncol = 1, byrow = FALSE,
      ...)

    split2source_mspct(x, spct.data.var = "s.e.irrad",
      w.length.var = "w.length", idx.var = NULL, ncol = 1, byrow = FALSE,
      ...)

    split2response_mspct(x, spct.data.var = "s.e.response",
      w.length.var = "w.length", idx.var = NULL, ncol = 1, byrow = FALSE,
      ...)

    split2filter_mspct(x, spct.data.var = "Tfr", w.length.var = "w.length",
      idx.var = NULL, ncol = 1, byrow = FALSE, ...)

    split2reflector_mspct(x, spct.data.var = "Rfr", w.length.var = "w.length",
      idx.var = NULL, ncol = 1, byrow = FALSE, ...)

    split2cps_mspct(x, spct.data.var = "cps", w.length.var = "w.length",
      idx.var = NULL, ncol = 1, byrow = FALSE, ...)

    split2raw_mspct(x, spct.data.var = "count", w.length.var = "w.length",
      idx.var = NULL, ncol = 1, byrow = FALSE, ...)

    split2calibration_mspct(x, spct.data.var = "irrad.mult",
      w.length.var = "w.length", idx.var = NULL, ncol = 1, byrow = FALSE,
      ...)

### Arguments

`x` | data frame
`member.class` | character Class of the collection members
`spct.data.var` | character Name of the spectral data argument in the object constructor for `member.class`
`w.length.var` | character Name of column containing wavelength data in nanometres
`idx.var` | character Name of column containing data to be copied unchanged to each spct object
`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.

### See Also

Other Coercion methods for collections of spectra: `as.calibration_mspct`, `as.chroma_mspct`, `as.cps_mspct`, `as.filter_mspct`, `as.generic_mspct`, `as.object_mspct`, `as.raw_mspct`, `as.reflector_mspct`, `as.response_mspct`, `as.source_mspct`, `subset2mspct`

[Package photobiology version 0.9.21 Index]