manage_na | R Documentation |
Sometimes you want to keep or remove NA values in intensities to allow for spectra with varying shapes to be analyzed together or maintained in a single Open Specy object.
manage_na(x, ...)
## Default S3 method:
manage_na(x, lead_tail_only = TRUE, ig = c(NA), ...)
## S3 method for class 'OpenSpecy'
manage_na(x, lead_tail_only = TRUE, ig = c(NA), fun, type = "ignore", ...)
x |
a numeric vector or an R OpenSpecy object. |
lead_tail_only |
logical whether to only look at leading adn tailing values. |
ig |
character vector, values to ignore. |
fun |
the name of the function you want run, this is only used if the "ignore" type is chosen. |
type |
character of either "ignore" or "remove". |
... |
further arguments passed to |
manage_na()
return logical vectors of NA locations (if vector provided) or an
OpenSpecy
object with ignored or removed NA values.
Win Cowger, Zacharias Steinmetz
OpenSpecy
object to be matched with a reference library
fill_spec()
can be used to fill NA values in Open Specy objects.
restrict_range()
can be used to restrict spectral ranges in other ways than removing NAs.
manage_na(c(NA, -1, NA, 1, 10))
manage_na(c(NA, -1, NA, 1, 10), lead_tail_only = FALSE)
manage_na(c(NA, 0, NA, 1, 10), lead_tail_only = FALSE, ig = c(NA,0))
data(raman_hdpe)
raman_hdpe$spectra[[1]][1:10] <- NA
#would normally return all NA without na.rm = TRUE but doesn't here.
manage_na(raman_hdpe, fun = make_rel)
#will remove the first 10 values we set to NA
manage_na(raman_hdpe, type = "remove")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.