#'Loads PROJECT_LOG R object
#'
#'This function loads the PROJECT_LOG from the PROJECT_LOG.RData file in the working directory. If the PROJECT_LOG.RData file does not exist, a blank one will be created, but will be populated using the update_project_log() function.
#'@param dirs_to_log character vector of the names of the directories that will be tracked for logging
#'@importFrom mirroR get_timestamp
#'@export
#'
load_project_log <-
function(dirs_to_log) {
if (!(file.exists("PROJECT_LOG.RData"))) {
log_csv_filenames <- get_log_csv_fns(dirs_to_log)
x <- list()
for (i in 1:length(log_csv_filenames)) {
log_csv_filename <- log_csv_filenames[i]
if (!(file.exists(log_csv_filename))) {
write_log_csv(dirs_to_log = dirs_to_log[i])
x[[i]] <- list()
x[[i]][[1]] <- readr::read_csv(log_csv_filename) %>%
somersaulteR::call_mr_clean() %>%
as.data.frame() %>%
somersaulteR::mutate_all_na_to_blank()
names(x[[i]])[1] <- mirroR::get_timestamp()
} else {
x[[i]] <- list()
x[[i]][[1]] <- readr::read_csv(log_csv_filename) %>%
somersaulteR::call_mr_clean() %>%
as.data.frame() %>%
somersaulteR::mutate_all_na_to_blank()
names(x[[i]])[1] <- mirroR::get_timestamp()
}
}
names(x) <- dirs_to_log
y <- list("CURRENT" = list())
x <- c(y, x)
base::assign("PROJECT_LOG", x, envir = base::globalenv())
base::saveRDS(x, "PROJECT_LOG.RData")
} else {
x <- base::readRDS("PROJECT_LOG.RData")
base::assign("PROJECT_LOG", x, envir = base::globalenv())
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.