tag: Tag a spectrum

Description Usage Arguments Value Methods (by class) Note See Also Examples

View source: R/spct.tag.r

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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, 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, 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

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)

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

1
2
tag(sun.spct)
tag(sun.spct, list(A = waveband(c(300,3005))))

photobiology documentation built on April 3, 2018, 1:06 a.m.