| ir_bin | R Documentation | 
ir_bin bins intensity values of infrared spectra into bins of a
defined width or into a defined number of bins.
ir_bin(x, width = 10, new_x_type = "start", return_ir_flat = FALSE)
| x | An object of class  | 
| width | An integer value indicating the wavenumber width of each resulting bin. | 
| new_x_type | A character value denoting how new wavenumber values for
the computed bins should be stored in the spectra of  
 | 
| return_ir_flat | Logical value. If  | 
If a wavenumber value exactly matches the boundary of a bin window, the respective intensity value will be assigned to both neighboring bins.
An object of class ir (or ir_flat, if return_ir_flat = TRUE),
where spectra have been binned.
# new wavenumber values are the first wavenumber value for each bin
x1 <-
   ir::ir_sample_data |>
   ir_bin(width = 50, new_x_type = "start")
# new wavenumber values are the last wavenumber value for each bin
x2 <-
   ir::ir_sample_data |>
   ir_bin(width = 50, new_x_type = "mean")
# new wavenumber values are the average of the wavenumber values assigned to
# each bin
x3 <-
   ir::ir_sample_data |>
   ir_bin(width = 50, new_x_type = "end")
# compare wavenumber values for first spectra.
cbind(x1$spectra[[1]]$x, x2$spectra[[1]]$x, x3$spectra[[1]]$x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.