manage_lib: Manage spectral libraries

check_libR Documentation

Manage spectral libraries

Description

These functions will import the spectral libraries from Open Specy if they were not already downloaded. The CRAN does not allow for deployment of large datasets so this was a workaround that we are using to make sure everyone can easily get Open Specy functionality running on their desktop.

Usage

check_lib(
  which = c("ftir", "raman"),
  types = c("metadata", "library", "peaks"),
  path = "system",
  condition = "warning"
)

get_lib(
  which = c("ftir", "raman"),
  types = c("metadata", "library", "peaks"),
  path = "system",
  node = "x7dpz",
  conflicts = "overwrite",
  ...
)

load_lib(
  which = c("ftir", "raman"),
  types = c("metadata", "library", "peaks"),
  path = "system"
)

Arguments

which

a character string specifying which library to use, "raman" or "ftir".

types

library types to check/retrieve; defaults to c("metadata", "library", "peaks").

path

where to save or look for local library files; defaults to "system" pointing to system.file("extdata", package = "OpenSpecy").

condition

determines if check_lib() should warn ("warning", the default) or throw and error ("error").

node

the OSF node to be retrieved; should be "x7dpz".

conflicts

determines what happens when a file with the same name exists at the specified destination. Can be one of the following (see osf_download() for details):

  • "error" throw an error and abort the file transfer operation.

  • "skip" skip the conflicting file(s) and continue transferring the remaining files.

  • "overwrite" (default) replace the existing file with the transferred copy.

...

further arguments passed to osf_download().

Details

check_lib() checks to see if the Open Specy reference library already exists on the users computer. get_lib() downloads the Open Specy library from OSF (doi: 10.17605/OSF.IO/X7DPZ). load_lib() will load the library into the global environment for use with the Open Specy functions.

Value

check_lib() and get_lib() return messages only; load_lib() returns a list object containing the respective spectral reference library.

Author(s)

Zacharias Steinmetz

References

Cowger W, Gray A, Christiansen SH, Christiansen SH, Christiansen SH, De Frond H, Deshpande AD, Hemabessiere L, Lee E, Mill L, et al. (2020). “Critical Review of Processing and Classification Techniques for Images and Spectra in Microplastic Research.” Applied Spectroscopy, 74(9), 989–1010. doi: 10.1177/0003702820929064.

Cowger, W (2021). “Library data.” OSF. doi: 10.17605/OSF.IO/X7DPZ.

See Also

match_spec()

Examples

## Not run: 
check_lib(which = c("ftir", "raman"))
get_lib(which = c("ftir", "raman"))

spec_lib <- load_lib(which = c("ftir", "raman"))

## End(Not run)


OpenSpecy documentation built on July 6, 2022, 5:07 p.m.