| ir_remove_missing {ir} | R Documentation |
Removes empty data values in an object of class ir
Description
ir_remove_missing takes and object of class ir and removes all
rows in the data.frames of the list column spectra that have
NA intensity values (column y). Additionally, one can specify
to remove rows in the ir object to discard if they contain empty
spectra.
Usage
ir_remove_missing(x, remove_rows = FALSE)
Arguments
x |
An object of class |
remove_rows |
A logical value indicating if rows in |
Value
x with cleaned spectra.
Examples
# create sample data with some missing rows and one entire missing spectra
x <-
ir::ir_sample_data
x$spectra[[1]] <- x$spectra[[1]][0, ]
x$spectra[[2]][1:100, "y"] <- NA_real_
# remove missing values (but remove no rows in x)
x1 <-
x %>%
ir::ir_remove_missing(remove_rows = FALSE)
# remove missing values (and remove rows in x if a compete spectrum is
# missing)
x2 <-
x %>%
ir::ir_remove_missing(remove_rows = TRUE)
nrow(x)
nrow(x1)
nrow(x2)
[Package ir version 0.2.1 Index]