R/stop_assignment.R

Defines functions stop_assignment

Documented in stop_assignment

#' Stop a call in a dtsurvey if its part of an assignment
#'
stop_assignment <- function(){

  callme = sys.calls()
  callme = lapply(callme, as.character)

  #check to see if `:=` is in the call history
  callme = vapply(callme, function(x) any(grepl('`:=`', x, fixed = T)), TRUE)

  if(any(callme)){
    stop('This function does not work with `:=`')
  }

  return(NULL)

}
dcaseykc/dtsurvey documentation built on March 9, 2024, 1:09 p.m.