R/clear.R

# Clear the workspace of all objects whose names don't start with a
# full stop, and remove objects attached immediately after the global 
clear <-
function () 
{
    env <- as.environment(1)
    to.go <- ls(env, all.names = FALSE)
    continue <- TRUE
    while (continue) {
        nxt <- search()[[2]]
        if (substr(nxt, 1, 8) != "package:") 
            detach()
        else continue <- FALSE
    }
    remove(list = to.go, envir = env)
}

Try the Epi package in your browser

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

Epi documentation built on March 19, 2024, 3:07 a.m.