diff --git a/R/normalize.R b/R/normalize.R index 07a7cf8..376d77c 100644 --- a/R/normalize.R +++ b/R/normalize.R @@ -35,15 +35,10 @@ #' spectra, Trends in Analytical Chemistry, 28(10):1201-1222. #' #' @param x A numeric matrix or data frame containing the spectra. -#' @param method A character vector specifying the normalization method to apply. -#' Available methods are: "area", "background", and "internal". -#' @param bkg A numeric matrix or data frame of the same dimension as `x`, specifying -#' the intensity of the continuum radiation (background emission) used for -#' normalizing `x`. Required for "background" method. -#' @param wlength A character vector of the selected wavelength(s) related to the -#' internal standard(s) peak intensity. Optional for "background" method. -#' @param drop.na A logical value indicating whether to remove missing values before -#' normalizing (default: `TRUE`). +#' @param method A character vector specifying the normalization method to apply. Available methods are: "area", "background", and "internal". +#' @param bkg A numeric matrix or data frame of the same dimension as `x`, specifying the intensity of the continuum radiation (background emission) used for normalizing `x`. Required for "background" method. +#' @param wlength A character vector of the selected wavelength(s) related to the internal standard(s) peak intensity. Optional for "background" method. +#' @param drop.na A logical value indicating whether to remove missing values before normalizing. Default is `TRUE`. #' #' @return A data frame of normalized spectra. #' diff --git a/R/outlierplot.R b/R/outlierplot.R index 15c4af6..ce5ba8c 100644 --- a/R/outlierplot.R +++ b/R/outlierplot.R @@ -60,13 +60,19 @@ outlierplot <- function(x, quan = 1/2, alpha = 0.025, show.outlier = TRUE, show. if (!is.numeric(quan) || quan < 0.5 || quan > 1) { stop("'quan' must be a numeric value between 0.5 and 1") } + if (!is.logical(show.outlier)) { + stop("'show.outlier' must be of type boolean (TRUE or FALSE)") + } + if (!is.logical(show.mahal)) { + stop("'show.mahal' must be of type boolean (TRUE or FALSE)") + } if (is.data.frame(x) || tibble::is_tibble(x)) { x <- as.matrix(x) } rob <- robustbase::covMcd(x, alpha = quan) - xarw <- adapt_reweight(x, rob$center, rob$cov, alpha = alpha) + xarw <- covARW(x, rob$center, rob$cov, alpha = alpha) if (xarw$cn != Inf) { alpha <- sqrt(c(xarw$cn, stats::qchisq(c(0.75, 0.5, 0.25), ncol(x)))) @@ -160,7 +166,7 @@ outlierplot <- function(x, quan = 1/2, alpha = 0.025, show.outlier = TRUE, show. } -adapt_reweight <- function(x, m0, c0, alpha, pcrit){ +covARW <- function(x, m0, c0, alpha, pcrit){ n <- nrow(x) p <- ncol(x) diff --git a/_pkgdown.yml b/_pkgdown.yml index d29925f..58cb3a1 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -9,10 +9,7 @@ reference: contents: - zscore - iqrMethod - - outlierplot - - adjusted_boxplot - directOutlyingness - - generalized_boxplot - title: Multivariate filtering @@ -50,10 +47,13 @@ reference: - title: Data visualization desc: > - Functions that help visualize the state of the data. + Functions that help assess data visually. contents: - plotfit - plotSpec + - outlierplot + - adjusted_boxplot + - generalized_boxplot - title: Smoothing desc: > diff --git a/man/normalize.Rd b/man/normalize.Rd index 5c53703..fa78641 100644 --- a/man/normalize.Rd +++ b/man/normalize.Rd @@ -9,18 +9,13 @@ normalize(x, method = "area", bkg = NULL, wlength = NULL, drop.na = TRUE) \arguments{ \item{x}{A numeric matrix or data frame containing the spectra.} -\item{method}{A character vector specifying the normalization method to apply. -Available methods are: "area", "background", and "internal".} +\item{method}{A character vector specifying the normalization method to apply. Available methods are: "area", "background", and "internal".} -\item{bkg}{A numeric matrix or data frame of the same dimension as \code{x}, specifying -the intensity of the continuum radiation (background emission) used for -normalizing \code{x}. Required for "background" method.} +\item{bkg}{A numeric matrix or data frame of the same dimension as \code{x}, specifying the intensity of the continuum radiation (background emission) used for normalizing \code{x}. Required for "background" method.} -\item{wlength}{A character vector of the selected wavelength(s) related to the -internal standard(s) peak intensity. Optional for "background" method.} +\item{wlength}{A character vector of the selected wavelength(s) related to the internal standard(s) peak intensity. Optional for "background" method.} -\item{drop.na}{A logical value indicating whether to remove missing values before -normalizing (default: \code{TRUE}).} +\item{drop.na}{A logical value indicating whether to remove missing values before normalizing. Default is \code{TRUE}.} } \value{ A data frame of normalized spectra.