R/clean.R

clean_session <- function(group, internal = F){
  if(!internal){
    opt_tag <- "store.rsession"
  }else{
    opt_tag <- "store.internal"
  }

  if(!missing(group)){

    lex <- options(opt_tag)[[1]]
    if(is.null(lex)){
      lex <- list()
    }

    lex[[group]] <- NULL

    lex1 <- list(lex)
    names(lex1) <- opt_tag
    options(lex1)

  }else{

    lput <- list(NULL)
    names(lput) <- opt_tag
    options(lput)


  }


  invisible()

}

clean_local <- function(group, local_path){

  file_path <- get_local_file_path(group, local_path)
  file_path %>% dirname() %>% list.files(recursive = T, full.names = T, include.dirs = T) %>% unlink(force = T, recursive = T)
  if(!missing(group)){
    file_path %>% dirname() %>% unlink(force = T, recursive = T)
  }

  invisible()

}
MadeInR/store documentation built on May 12, 2019, 8:41 a.m.