R/drop.R

Defines functions remove_if_exists

#' R6 class for the removal of variables from a pipeline
#' 
#' @description  
#' A `Deident` class dealing with the exclusion of variables.
#' 
#' @export
Drop <- R6Class(

  "Drop",
  list(
    transform = function(keys, ...){

    },
    mutate = function(data, ...){
      remove_if_exists(data, ...)
    }
  ),
  inherit = BaseDeident
)


remove_if_exists <- function(frm, ...){

  to_drop <- overlap(frm, ...)
  select(frm, -all_of(to_drop))
}

Try the deident package in your browser

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

deident documentation built on April 3, 2025, 6:14 p.m.