Learn R Programming

specmine (version 4.0.0)

raman_crop_spectra: Crop Raman or SERS spectra to a wavenumber interval

Description

Restricts a Raman or surface-enhanced Raman spectroscopy (SERS) dataset to an inclusive wavenumber interval.

Usage

raman_crop_spectra(dataset, min_wn, max_wn)

Value

A dataset equivalent to dataset, with dataset$data

restricted to wavenumbers between min_wn and max_wn. The dataset$wavenumbers element is updated or created to match the cropped data.

Arguments

dataset

A dataset list containing a numeric matrix in dataset$data, with wavenumbers in rows and samples in columns. Optionally, it may contain a numeric vector in dataset$wavenumbers.

min_wn

Single finite numeric value specifying the lower inclusive wavenumber limit.

max_wn

Single finite numeric value specifying the upper inclusive wavenumber limit.

Details

The dataset must contain wavenumbers in rows and samples in columns. Wavenumbers are obtained from dataset$wavenumbers when available. Otherwise, numeric row names in dataset$data are used.

Examples

Run this code
dataset = list(
  data = matrix(
    seq_len(30),
    nrow = 6,
    dimnames = list(
      as.character(seq(400, 900, by = 100)),
      paste0("sample", 1:5)
    )
  ),
  wavenumbers = seq(400, 900, by = 100)
)

cropped = raman_crop_spectra(
  dataset,
  min_wn = 500,
  max_wn = 800
)

cropped$wavenumbers

Run the code above in your browser using DataLab