R/cls.R

Defines functions cls

cls <- function() {
  pkgs<-.packages() # get list of pkgs loaded
  pkgs<-pkgs[(!pkgs %in% c('methods','base','stats','utils'))] #remove these from the list
  pkg.locs<-sapply(pkgs,devtools::inst) # get location of the packges still in list
  lapply(pkg.locs,devtools::unload) #finally unload those packages in list
  rm(list = ls(envir = globalenv()),envir = globalenv()) #clear Vars from global enviroment
  gc()  #collect garbage
    .rs.restartR() #clear session
  cat("\014") #clear repl
  message("REPL cleared.")
}
JARS3N/0 documentation built on Sept. 3, 2017, 12:37 a.m.