Removes all objects in the global environment including hidden objects, and afterwards runs the garbage collector to free up memory.

clearEnv(envir = .GlobalEnv, hidden = TRUE)

Arguments

envir

(optional) The environment to clear. default: .GlobalEnv

hidden

(optional) Include hidden objects (those starting with a dot "."). default: TRUE

Value

Prints the removed objects, their classes, and the output from garbage collector.

Examples

assign("test", "test", envir = .GlobalEnv) clearEnv()
#> The following 2 objects were removed: #> *object* *class* #> .Random.seed integer #> test character #> #> Garbage collector: #>
#> used (Mb) gc trigger (Mb) limit (Mb) max used (Mb) #> Ncells 767416 41 1285998 68.7 NA 767416 41 #> Vcells 1429987 11 8388608 64.0 16384 1429987 11