#' Creates the project directory tree using the names of desired input and output directories
#' @param input_dir_names character vector of input directory names that will have "NEW" and "LOADED" subdirectories
#' @param output_dir_names character vector of output directory names (does not have subdirectories)
#' @param other_dir_names character vector of any other directory names (identical to output_dir_names)
#' @export
setup_project_dirtree <-
function(input_dir_names = c("INPUT","CONTROL"),
output_dir_names = NULL,
other_dir_names = NULL) {
new_dir_paths <- paste0("./", input_dir_names)
for (i in 1:length(new_dir_paths)) {
if (!(dir.exists(new_dir_paths[i]))) {
dir.create(new_dir_paths[i])
}
}
new_subdir_names <- c("NEW", "LOADED")
for (i in 1:length(new_dir_paths)) {
for (j in 1:length(new_subdir_names)) {
new_dir_path <- new_dir_paths[i]
new_subdir_name <- new_subdir_names[j]
new_subdir_path <- paste0("./", new_dir_path, "/", new_subdir_name)
if (!(dir.exists(new_subdir_path))) {
dir.create(new_subdir_path)
}
}
}
if (!(is.null(output_dir_names))) {
new_dir_paths <- paste0("./", output_dir_names)
for (i in 1:length(new_dir_paths)) {
if (!(dir.exists(new_dir_paths[i]))) {
dir.create(new_dir_paths[i])
}
}
}
if (!(is.null(other_dir_names))) {
new_dir_paths <- paste0("./", other_dir_names)
for (i in 1:length(new_dir_paths)) {
if (!(dir.exists(new_dir_paths[i]))) {
dir.create(new_dir_paths[i])
}
}
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.