R/removeIfExists.R

Defines functions removeIfExists

Documented in removeIfExists

removeIfExists <-
function(candidates, envir = KTSEnv) {
  doTheyExist <- sapply(candidates, 
                        function(x) y <- exists(x, envir = envir))
  elesToRm <- candidates[which(doTheyExist == TRUE)]
  if (length(elesToRm) > 0) {
    rm(list = elesToRm, envir = envir)
  }
}

Try the KarsTS package in your browser

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

KarsTS documentation built on Jan. 16, 2021, 5:07 p.m.