tag {photobiology} | R Documentation |
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, ...)
## Default S3 method:
tag(x, ...)
## S3 method for class '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 class '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 |
byref |
logical Flag indicating if new object will be created by
reference or by copy of |
.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)
-
tag(default)
: Default method for generic -
tag(generic_spct)
: Tag one ofgeneric_spct
, and derived classes includingsource_spct
,filter_spct
,reflector_spct
,object_spct
, andresponse_spct
. -
tag(generic_mspct)
: Tag one ofgeneric_mspct
, and derived classes includingsource_mspct
,filter_mspct
,reflector_mspct
,object_mspct
, andresponse_mspct
.
Note
NULL
as w.band
argument does not add any new tags,
instead it removes existing tags if present. NA
, the default, as
w.band
argument removes existing waveband tags if present and
sets the wl.color
variable. If a waveband object or a list of
wavebands is supplied as argument then tagging is based on them, and
wl.color
is also set.
See Also
Other tagging and related functions:
is_tagged()
,
untag()
,
wb2rect_spct()
,
wb2spct()
,
wb2tagged_spct()
Examples
tag(sun.spct)
tag(sun.spct, list(A = waveband(c(300,3005))))