ir_as_ir {ir} | R Documentation |
Generic to convert objects to class ir
Description
ir_as_ir
ir the generic to convert an object to an object of class
ir
.
Usage
ir_as_ir(x, ...)
## S3 method for class 'ir'
ir_as_ir(x, ...)
## S3 method for class 'data.frame'
ir_as_ir(x, ...)
Arguments
x |
An object. |
... |
Further arguments passed to individual methods.
|
Value
An object of class ir
.
Examples
# conversion from an ir object
ir::ir_sample_data %>%
ir_as_ir()
# conversion from a data frame
x_ir <- ir::ir_sample_data
x_df <-
x_ir %>%
ir_drop_spectra() %>%
dplyr::mutate(
spectra = x_ir$spectra
) %>%
ir_as_ir()
# check that ir_as_ir preserves the input class
ir_sample_data %>%
structure(class = setdiff(class(.), "ir")) %>%
dplyr::group_by(sample_type) %>%
ir_as_ir()
[Package ir version 0.2.1 Index]