View source: R/ir_variance_region.R
ir_variance_region | R Documentation |
ir
object in a given regionir_variance_region
takes a spectrum x
and, depending on the
arguments computes the following summary:
subtract_smoothed = FALSE
it computes the variance of the
intensity values for each spectrum in x
. If in addition range
is not NULL
, it computes the variance only for the region(s)
represented by range
.
subtract_smoothed = TRUE
it smoothes x
, subtracts
the smoothed x
from the unsmoothed x
and computes the
variance of the difference intensity values. If in addition range
is
not NULL
, it computes the variance only for the region(s)
represented by range
.
ir_variance_region(
x,
subtract_smoothed = FALSE,
do_normalize = FALSE,
normalize_method,
...,
range = NULL
)
x |
An object of class |
subtract_smoothed |
A logical value. If |
do_normalize |
A logical value. If set to |
normalize_method |
See |
... |
Arguments passed to |
range |
See |
x
with two additional columns:
A numeric vector with the computed variances of the intensity values for the respective spectra.
An integer vector with the number of intensity values used during computing the variance.
# Whole spectra variance
x1 <-
ir::ir_sample_data |>
ir::ir_variance_region(
subtract_smoothed = FALSE,
do_normalize = TRUE,
normalize_method = "area",
range = NULL
)
# Spectra variance, but only from a specific region
range <- data.frame(start = 2700, end = 2800)
x2 <-
ir::ir_sample_data |>
ir::ir_normalize(method = "area") |>
ir::ir_variance_region(
subtract_smoothed = FALSE,
do_normalize = TRUE,
normalize_method = "area",
range = range
)
# Spectra variance after subtracting a smoothed version of the spectra and
# only from a specific region
x3 <-
ir::ir_sample_data %>%
ir::ir_variance_region(
subtract_smoothed = TRUE,
do_normalize = FALSE,
range = range,
p = 3, n = 31, ts = 1, m = 0
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.