View source: R/gen_coreDataManip.r
do_detrend | R Documentation |
Perform de-trending of the given dataset. For each observation,
the linear model lm(absorbance ~ wavelength)
is calculated. The
coefficients of the resulting model are then used to modify the absorbance
values after the formula
newAbsorbance = absorbance - intercept - k*wavelength
. It is possible
to separately specify the source and the target of the de-trend operation.
do_detrend(dataset, src = NULL, trg = "src", exportModel = FALSE)
dataset |
An object of class 'aquap_data' as produced e.g. by
|
src |
'source'; the wavelength-range from where the values for de-trend should be calculated (i.e. the linear models). Leave at the default NULL to use the full range of wavelengths in the provided dataset, or provide a numeric length two to use this wavelength range for calculating the values for de-trend. |
trg |
'target'; character length one or numeric length two. The wavelengths
where the de-trend should be applied. If left at the default 'src' the same
wavelength as specified in
|
exportModel |
Logical. If a possible model should be stored in the set,
(leave at |
Via the arguments src
('source') and trg
('target')
it is possible to specify separately from which wavelength-range the values
for the de-trend should be taken resp. to which wavelength-range the
resulting de-trend should be applied. Please see documentation for the
arguments src
and trg
for further details. If the target
wavelengths are only a part of the whole wavelength-range in the dataset,
the de-trend will be applied only to this wavelengths, and the rest of the
wavelengths will remain unchanged. Abrupt steps in the resulting spectra can
be the result of this. If both arguments src
and trg
are left
at their defaults, the full range of wavelengths in the dataset is used for
calculating the de-trend values, i.e. the linear models, and the resulting
de-trend is also applied to the full range of wavelengths present in the
dataset.
The transformed dataset
Other Data pre-treatment functions:
[,aquap_data-method
,
do_addNoise()
,
do_avg()
,
do_blowup()
,
do_emsc()
,
do_gapDer()
,
do_msc()
,
do_resampleNIR()
,
do_sgolay()
,
dpt_modules
,
selectWls()
,
ssc()
Other dpt modules documentation:
do_emsc()
,
do_gapDer()
,
do_msc()
,
do_sgolay()
,
do_snv()
,
dpt_modules
## Not run:
fd <- gfd()
fdDT <- do_detrend(fd) # use the whole wavelength range of 'fd' as source and
# target for the de-trend
plot(fd)
plot(fdDT)
###
fdc <- selectWls(fd, 1300, 1600)
plot(fdc)
plot(do_detrend(fdc)) # whole range as source and target
plot(do_detrend(fdc, src=c(1400, 1500))) # same target as soruce
plot(do_detrend(fdc, src=c(1400, 1500), trg="all")) # apply to full range
plot(do_detrend(fdc, src=c(1400, 1500), trg=c(1300, 1600))) # same as above
plot(do_detrend(fdc, src=c(1300, 1400), trg=c(1380, 1580)))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.