View source: R/plot_robust_pca.R
| flagged_regions | R Documentation |
Lists the wavelength regions where many observations have cells flagged
by macropca() or cellpca(): runs of adjacent channels (on the same detector segment)
whose share of flagged observations is at least threshold. These are
the channels that persistently deviate from the PCA fit, for example
emission lines affected by self-absorption, saturation or matrix
effects, and candidates to exclude or down-weight. plot_cell_map()
labels the regions with the largest share.
flagged_regions(
object,
threshold = 0.1,
rows = NULL,
columns = NULL,
lines = NULL,
tol = 0.1
)
object |
An object returned by |
threshold |
The share of flagged observations above which channels form a flagged region. Default is 0.1. |
rows, columns |
Optional indices or names of the rows and columns to show. Default is all. |
lines |
Optional line list returned by |
tol |
The largest distance, in nm, between a region and a line it matches. Default is 0.1. |
Runs separated by at most two channels below the threshold are merged. A
region is "higher" when at least two thirds of its flagged cells are
higher than the fit, "lower" when at most one third are, and "mixed"
otherwise. With lines, the lines between start - tol and end + tol
are the candidates, from the nearest to the peak.
A tibble with one row per region, sorted by decreasing share,
and columns start, end and peak (the wavelength, or variable
number, of the largest share), channels (the number of channels),
share (the largest share of flagged observations), mean_share and
direction. With lines, it also has the columns species and
line_wavelength of the nearest line (NA when none) and
candidates.
Christian L. Goueguel
plot_cell_map(), macropca(), libs_lines()
data(forageLIBS)
# the 380-430 nm window (Ca II H and K lines), faster than all the channels
wl <- suppressWarnings(as.numeric(names(forageLIBS)))
spectra <- forageLIBS[which(wl > 380 & wl < 430)]
set.seed(1)
fit <- macropca(center(spectra), ncomp = 3)
flagged_regions(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.