R/qualify_changes.R

Defines functions .qualify_changes

.qualify_changes <- function(new, old) {
  new_names <- setdiff(names(new),"DataVersion")
  old_names <- setdiff(names(old),"DataVersion")
  added <- NULL
  deleted <- NULL
  changed <- NULL
  added <- setdiff(new_names,old_names)
  deleted <- setdiff(old_names,new_names)
  common <- intersect(new_names,old_names)
  #test for equality
  changed <- purrr::keep(
    purrr::map2(new[common], old[common], `!=`),
    .p = function(x) {
      x == FALSE
    }
  )
  changed <- names(changed)
  list(added = added,
       deleted = deleted,
       changed = changed)
}

Try the DataPackageR package in your browser

Any scripts or data that you put into this service are public.

DataPackageR documentation built on May 29, 2024, 9:15 a.m.