knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "90%",
  out.height = "90%",
  fig.retina = 2
)

specProc

Project Status: WIP -- Initial development is in progress, but there
has not yet been a stable, usable release suitable for the
public. Lifecycle:
experimental License:
MIT Codecov test
coverage R-CMD-check GitHub last commit GitHub repo size GitHub R package version GitHub language count

Testing and experimenting.

The specProc package performs a wide range of preprocessing tasks essential for spectroscopic data analysis. Spectral preprocessing is essential in ensuring accurate and reliable results by minimizing the impact of various distortions and artifacts that can arise during data acquisition or due to inherent characteristics of the sample or instrument.

Some techniques are purely based on mathematical concepts, relying on robust statistics and signal processing techniques. Other methods are inspired by the physicochemical context of the dataset. These techniques rely on domain knowledge and exploit the fundamental principles governing the spectroscopic phenomenon used.

Installation

You can install the development version from GitHub with:

install.packages("devtools")
devtools::install_github("ChristianGoueguel/specProc")
options(mc_doScale_quiet=TRUE)

Examples

set.seed(02301)
tbl <- data.frame(
  normal = stats::rnorm(100),
  skewed = stats::rgamma(100, shape = 2, scale = 1),
  heavy_tailed = stats::rcauchy(100, location = 0, scale = 1)
  )
ggplot2::ggplot(tbl) +
  ggplot2::geom_density(ggplot2::aes(x = normal, fill = "Normal"), linewidth = 0.1, adjust = 2L, alpha = 1/5) +
  ggplot2::geom_density(ggplot2::aes(x = skewed, fill = "Skewed"), linetype = "dashed", linewidth = 0.1, adjust = 2L, alpha = 1/5) +
  ggplot2::geom_density(ggplot2::aes(x = heavy_tailed, fill = "Heavy-tailed"), linetype = "dotted", linewidth = 0.1, adjust = 2L, alpha = 1/5) +
  ggplot2::scale_fill_manual(values = c("Normal" = "#112446", "Skewed" = "red", "Heavy-tailed" = "blue")) +
  ggplot2::xlim(-10,10) +
  ggplot2::labs(x = "x", fill = "Distribution") +
  ggplot2::theme_light() +
  ggplot2::theme(legend.position = "right", panel.grid = ggplot2::element_blank())

descriptive statistics

classical approach

specProc::summaryStats(tbl)

robust approach

specProc::summaryStats(tbl, robust = TRUE)

adjusted boxplot

specProc::adjusted_boxplot(tbl, xlabels.angle = 0) +
  ggplot2::geom_hline(yintercept = 0, linetype = "dashed", linewidth = 0.1) +
  ggplot2::coord_flip()

generalized boxplot

specProc::generalized_boxplot(tbl, xlabels.angle = 0) +
  ggplot2::geom_hline(yintercept = 0, linetype = "dashed", linewidth = 0.1) +
  ggplot2::coord_flip()

correlation

data("glass", package = "chemometrics")
glass <- tibble::as_tibble(glass)
glass |> specProc::correlation(Na2O, method = "spearman", .plot = TRUE)


ChristianGoueguel/specProc documentation built on Nov. 9, 2024, 3:23 p.m.