baseline_correction: Auto-exported function: baseline_correction

View source: R/preprocessing.R

baseline_correctionR Documentation

Auto-exported function: baseline_correction

Description

Auto-exported function: baseline_correction

Usage

baseline_correction(dataset, method = "modpolyfit", ...)

Arguments

dataset

Dataset to correct.

method

Baseline correction method passed to 'baseline::baseline()'.

...

Additional arguments passed to 'baseline::baseline()'.

Value

A dataset object containing the baseline-corrected data. The returned object has the same overall structure as the input dataset, with corrected intensity values stored in dataset$data, original row and column names preserved, and the description updated to record the baseline correction step.

Examples


datamatrix <- matrix(
  c(5, 6, 7,
    6, 7, 8,
    7, 8, 9,
    8, 9, 10,
    9, 8, 7,
    8, 7, 6,
    7, 6, 5,
    6, 5, 4),
  nrow = 8,
  byrow = TRUE,
  dimnames = list(as.character(1:8), c("s1", "s2", "s3"))
)
metadata <- data.frame(
  class = c("A", "A", "B"),
  row.names = c("s1", "s2", "s3")
)
dataset <- list(
  data = datamatrix,
  metadata = metadata,
  description = "toy spectra",
  labels = list(x = "ppm", val = "intensity")
)
corrected <- try(
  baseline_correction(dataset, method = "modpolyfit"),
  silent = TRUE
)
corrected



specmine documentation built on Aug. 5, 2026, 5:06 p.m.