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

setGenericSpct

Convert an R object into a spectrum object.


Description

Sets the class attribute of a data.frame or an object of a derived class to "generic_spct".

Usage

setGenericSpct(x, multiple.wl = 1L, idfactor = NULL)

setCalibrationSpct(
  x,
  strict.range = getOption("photobiology.strict.range", default = FALSE),
  multiple.wl = 1L,
  idfactor = NULL
)

setRawSpct(
  x,
  strict.range = getOption("photobiology.strict.range", default = FALSE),
  multiple.wl = 1L,
  idfactor = NULL
)

setCpsSpct(
  x,
  time.unit = "second",
  strict.range = getOption("photobiology.strict.range", default = FALSE),
  multiple.wl = 1L,
  idfactor = NULL
)

setFilterSpct(
  x,
  Tfr.type = c("total", "internal"),
  Rfr.constant = NA_real_,
  thickness = NA_real_,
  attenuation.mode = NA,
  strict.range = getOption("photobiology.strict.range", default = FALSE),
  multiple.wl = 1L,
  idfactor = NULL
)

setReflectorSpct(
  x,
  Rfr.type = c("total", "specular"),
  strict.range = getOption("photobiology.strict.range", default = FALSE),
  multiple.wl = 1L,
  idfactor = NULL
)

setObjectSpct(
  x,
  Tfr.type = c("total", "internal"),
  Rfr.type = c("total", "specular"),
  strict.range = getOption("photobiology.strict.range", default = FALSE),
  multiple.wl = 1L,
  idfactor = NULL
)

setResponseSpct(
  x,
  time.unit = "second",
  response.type = "response",
  multiple.wl = 1L,
  idfactor = NULL
)

setSourceSpct(
  x,
  time.unit = "second",
  bswf.used = c("none", "unknown"),
  strict.range = getOption("photobiology.strict.range", default = FALSE),
  multiple.wl = 1L,
  idfactor = NULL
)

setChromaSpct(x, multiple.wl = 1L, idfactor = NULL)

Arguments

x

data.frame, list or generic_spct and derived classes

multiple.wl

numeric Maximum number of repeated w.length entries with same value.

idfactor

character Name of factor distinguishing multiple spectra when stored logitudinally (required if mulitple.wl > 1).

strict.range

logical Flag indicating whether off-range values result in an error instead of a warning.

time.unit

character string indicating the time unit used for spectral irradiance or exposure ("second" , "day" or "exposure") or an object of class duration as defined in package lubridate.

Tfr.type

character A string, either "total" or "internal".

Rfr.constant

numeric The value of the reflection factor (/1).

thickness

numeric The thickness of the material.

attenuation.mode

character One of "reflection", "absorption" or "mixed".

Rfr.type

character A string, either "total" or "specular".

response.type

a character string, either "response" or "action".

bswf.used

character A string, either "none" or the name of a BSWF.

Value

x

Functions

  • setCalibrationSpct: Set class of a an object to "calibration_spct".

  • setRawSpct: Set class of a an object to "raw_spct".

  • setCpsSpct: Set class of a an object to "cps_spct".

  • setFilterSpct: Set class of an object to "filter_spct".

  • setReflectorSpct: Set class of a an object to "reflector_spct".

  • setObjectSpct: Set class of an object to "object_spct".

  • setResponseSpct: Set class of an object to "response_spct".

  • setSourceSpct: Set class of an object to "source_spct".

  • setChromaSpct: Set class of an object to "chroma_spct".

Note

This method alters x itself by reference and in addition returns x invisibly.

For non-diffusing materials like glass an approximate Rfr.constant value can be used to interconvert "total" and "internal" transmittance values. Use NA if not known, or not applicable, e.g., for materials subject to internal scattering.

See Also

Other set and unset spectral class functions: rmDerivedSpct()

Examples

my.df <- data.frame(w.length = 300:309, s.e.irrad = rep(100, 10))
is.source_spct(my.df)
setSourceSpct(my.df)
is.source_spct(my.df)

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.