R/check_ref_to_new.R

Defines functions check_ref_to_new

Documented in check_ref_to_new

#' check_ref_to_new
#' @param xref a
#' @param xnew a
#' @export
check_ref_to_new <- function(xref, xnew) {
  fail <- FALSE
  error_msg <- c()
  # reference files missing in new export
  trouble <- xref[!xref %in% xnew]
  if (length(trouble) > 0) {
    error_msg <- c(error_msg, crayon::red(glue::glue("\u2716 Missing in new: {trouble}\n\n")))
    fail <- TRUE
  }

  # new export files
  trouble <- xnew[!xnew %in% xref]
  if (length(trouble) > 0) {
    error_msg <- c(error_msg, crayon::red(glue::glue("\u2716 Something new: {trouble}\n\n")))
    fail <- TRUE
  }

  if (fail) {
    stop("\n", error_msg)
  }
}
folkehelseinstituttet/dashboards_noispiah documentation built on Jan. 25, 2020, 11:53 p.m.