R/export_spectra_rds.R

Defines functions export_spectra_rds

Documented in export_spectra_rds

#' @title Export spectra RDS
#'
#' @description This function exports spectra in RDS
#'
#' @include create_dir.R
#'
#' @param file File where spectra will be exported.
#' @param spectra The spectra object where spectra are stored
#'
#' @return NULL
#'
#' @examples NULL
export_spectra_rds <- function(file, spectra) {
  if (nrow(spectra |>
    tidytable::filter(!is.na(compound_id))) != 0) {
    create_dir(export = file)
    spectra |>
      data.frame() |>
      saveRDS(file = file)
  }
}
taxonomicallyinformedannotation/tima-r documentation built on Nov. 20, 2024, 4:34 a.m.