R/reset_project_log.R

Defines functions reset_project_log

Documented in reset_project_log

#' Reset PROJECT_LOG object and RData file
#' @param dirs_to_log character vector of directories that will be logged by projectLoggeR
#' @param reset_csv logical. If TRUE, all the log csvs belonging to the directories will also be reset
#' @importFrom typewriteR stop_and_enter
#' @importFrom typewriteR tell_me
#' @export
#' @export

reset_project_log <-
        function(dirs_to_log, reset_csvs = FALSE) {
                typewriteR::tell_me("WARNING: This function will delete the PROJECT_LOG.RData file!")
                typewriteR::stop_and_enter()
                base::file.remove("PROJECT_LOG.RData")
                base::rm("PROJECT_LOG", envir = globalenv())

                if (reset_csvs) {
                        for (i in 1:length(dirs_to_log)) {
                                dir_to_log <- dirs_to_log[i]
                                reset_log_csv(dir_to_log = dir_to_log)
                        }
                }

                load_project_log_from_rdata(dirs_to_log = dirs_to_log)
        }
patelm9/projectloggeR documentation built on Nov. 4, 2019, 11:21 p.m.