Find wavelength values in a spectrum
Find wavelength values corresponding to a target y value in any spectrum. The name of the column of the spectral data to be used to match the target needs to be passed as argument unless the spectrum contains a single numerical variable in addition to "w.length".
find_wls( x, target = NULL, col.name.x = NULL, col.name = NULL, .fun = `<=`, interpolate = FALSE, idfactor = FALSE, na.rm = FALSE )
x |
an R object |
target |
numeric value indicating the spectral quantity value for which wavelengths are to be searched and interpolated if need. The character strings "half.maximum" and "half.range" are also accepted as arguments. |
col.name.x |
character The name of the column in which to the
independent variable is stored. Defaults to "w.length" for objects of class
|
col.name |
character The name of the column in which to search for the target value. |
.fun |
function A binary comparison function or operator. |
interpolate |
logical Indicating whether the nearest wavelength value in
|
idfactor |
logical or character Generates an index column of factor
type. If |
na.rm |
logical indicating whether |
A spectrum object of the same class as x
with fewer rows,
possibly even no rows. If FALSE
is passed to interpolate
a
subset of x
is returned, otherwise a new object of the same class
containing interpolated wavelenths for the target
value is returned.
This function is used internally by method wls_at_target()
, and
these methods should be preferred in user code and scripts.
find_wls(white_led.source_spct) find_wls(white_led.source_spct, target = "half.maximum") find_wls(white_led.source_spct, target = 0.4) find_wls(white_led.source_spct, target = 0.4, interpolate = TRUE) find_wls(white_led.source_spct, target = c(0.3, 0.4)) find_wls(white_led.source_spct, target = c(0.3, 0.4), idfactor = "target") find_wls(white_led.source_spct, target = c(0.3, 0.4), idfactor = TRUE) find_wls(white_led.source_spct, target = c("HM", "HR")) find_wls(white_led.source_spct, target = c("HM", "HR"), interpolate = TRUE) led.df <- as.data.frame(white_led.source_spct) find_wls(led.df, col.name = "s.e.irrad", col.name.x = "w.length") find_wls(led.df, col.name = "s.e.irrad", col.name.x = "w.length", target = 0.4) find_wls(led.df, col.name = "s.e.irrad", col.name.x = "w.length", target = c(0.3, 0.4)) find_wls(led.df, col.name = "s.e.irrad", col.name.x = "w.length", target = 0.4, idfactor = "target")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.