Learn R Programming

photobiology (version 0.10.6)

tag: Tag a spectrum

Description

Spectra are tagged by adding variables and attributes containing color definitions, labels, and a factor following the wavebands given in w.band. This methods are most useful for plotting realistic computed colors from spectral data.

Usage

tag(x, ...)

# S3 method for default tag(x, ...)

# S3 method for generic_spct tag( x, w.band = NULL, wb.trim = getOption("photobiology.waveband.trim", default = TRUE), use.hinges = TRUE, short.names = TRUE, chroma.type = "CMF", byref = FALSE, ... )

# S3 method for generic_mspct tag( x, w.band = NULL, wb.trim = getOption("photobiology.waveband.trim", default = TRUE), use.hinges = TRUE, short.names = TRUE, chroma.type = "CMF", byref = FALSE, ..., .parallel = FALSE, .paropts = NULL )

Arguments

x

an R object.

...

ignored (possibly used by derived methods).

w.band

waveband or list of waveband objects. The waveband(s) determine the region(s) of the spectrum that are tagged

wb.trim

logical Flag telling if wavebands crossing spectral data boundaries are trimmed or ignored

use.hinges

logical Flag indicating whether to insert "hinges" into the spectral data before integration so as to reduce interpolation errors at the boundaries of the wavebands.

short.names

logical Flag indicating whether to use short or long names for wavebands

chroma.type

character telling whether "CMF", "CC", or "both" should be returned for human vision, or an object of class chroma_spct for any other trichromic visual system.

byref

logical Flag indicating if new object will be created by reference or by copy of x

.parallel

if TRUE, apply function in parallel, using parallel backend provided by foreach

.paropts

a list of additional options passed into the foreach function when parallel computation is enabled. This is important if (for example) your code relies on external data or packages: use the .export and .packages arguments to supply them so that all cluster nodes have the correct environment set up for computing.

Value

A copy of x expanded with additional columns with color-related information.

Methods (by class)

  • default: Default method for generic

  • generic_spct: Tag one of generic_spct, and derived classes including source_spct, filter_spct, reflector_spct, object_spct, and response_spct.

  • generic_mspct: Tag one of generic_mspct, and derived classes including source_mspct, filter_mspct, reflector_mspct, object_mspct, and response_mspct.

See Also

Other tagging and related functions: is_tagged(), untag(), wb2rect_spct(), wb2spct(), wb2tagged_spct()

Examples

Run this code
# NOT RUN {
tag(sun.spct)
tag(sun.spct, list(A = waveband(c(300,3005))))

# }

Run the code above in your browser using DataLab