View source: R/colorSpec.ops.R
| applyspec | R Documentation |
apply a function to each spectrum in a colorSpec object
## S3 method for class 'colorSpec'
applyspec( x, FUN, ... )
x |
a colorSpec object with N wavelengths |
FUN |
a function that takes an N-vector as argument and returns an N-vector |
... |
additional arguments passed to |
applyspec() simply calls apply()
with the right MARGIN.
a colorSpec object with the same dimensions,
wavelength, quantity, and organization.
If FUN does not return an N-vector, it is an ERROR and
applyspec() returns NULL.
quantity,
wavelength,
linearize,
organization,
apply
# convert absorbance to transmittance
path = system.file( "extdata/stains/Hematoxylin.txt", package='colorSpec' )
x = readSpectra( path )
x = applyspec( x, function(y) {10^(-y)} ) # this is what linearize(x) does
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.