-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcreate_folder_structure.R
More file actions
26 lines (20 loc) · 918 Bytes
/
Copy pathcreate_folder_structure.R
File metadata and controls
26 lines (20 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# RStudio Cloud Tutorial for participants in Columbia Mailman SHARP Training
# Robbie M Parks 2022
# Script to initially create and define folder structure if not already there
print('Creating folder structure')
# load here package
library(here)
# declare directories
project.folder <- paste0(here::here(),'/')
basics.folder <- paste0(project.folder, "basics/")
exercises.folder <- paste0(project.folder, "exercises/")
images.folder <- paste0(project.folder, "images/")
# identify list of folder locations which have just been created above
folders.names <- grep(".folder",names(.GlobalEnv),value=TRUE)
# create function to create list of folders
# note that the function will not create a folder if it already exists
create_folders <- function(name){
ifelse(!dir.exists(get(name)), dir.create(get(name), recursive=TRUE), FALSE)
}
# create the folders named above
lapply(folders.names, create_folders)