Learn R Programming

ir (version 0.4.1)

ir_get_wavenumberindex: Gets the index of a defined wavenumber value for a spectrum

Description

ir_get_wavenumberindex gets for a defined wavenumber value or set of wavenumber values the corresponding indices (row number) in an object of class ir that has been flattened with ir_flatten(). If the specified wavenumber values do not match exactly the wavenumber values in the ir object, the indices for the next wavenumber values will be returned, along with a warning.

Usage

ir_get_wavenumberindex(x, wavenumber, warn = TRUE)

Value

An integer vector with the same length as wavenumber with the row indices of x corresponding to the wavenumber values in wavenumber.

Arguments

x

A data.frame with a column x representing the x units of a spectrum or several spectra (e.g. in the form of an object of class ir_flat).

wavenumber

A numeric vector with wavenumber values for which to get indices.

warn

logical value indicating if warnings should be displayed (TRUE) or not (FALSE).

Examples

Run this code
x_index_1090 <-
   ir::ir_sample_data |>
   ir::ir_flatten() |>
   ir::ir_get_wavenumberindex(wavenumber = 1090)

Run the code above in your browser using DataLab