Learn R Programming

KarsTS (version 2.3)

removeIfExists: removeIfExists: remove if exists

Description

This function checks whether a variable exists and removes it in case it does. It is used to clean KTSEnv from global variables created as by-products of the procedures. It is used internally.

Usage

removeIfExists(candidates, envir = KTSEnv)

Arguments

candidates

The names of the variables to remove.

envir

The environment

Examples

Run this code
# NOT RUN {
# Create a vector in the KTSEnv environment
KTSEnv$ThisExists <- 1:30

# It does not throw an error when the element to remove does not exist
removeIfExists(c("ThisExists", "ThisDoesNot"), envir = KTSEnv)


# }

Run the code above in your browser using DataLab