-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.R
More file actions
34 lines (27 loc) · 876 Bytes
/
setup.R
File metadata and controls
34 lines (27 loc) · 876 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
27
28
29
30
31
32
33
34
# Set up script to execute workflow
# Load libraries ---------------------------------------------------------------
## function to load/install packages (reproducible across machines/local systems)
package_load <- function(x) {
for (i in 1:length(x)) {
if (!x[i] %in% installed.packages()) {
install.packages(x[i])
}
library(x[i], character.only = TRUE)
}
}
## list all required packages
packages <- c('tidyverse',
'sf',
'terra',
'vroom',
'tools',
'ncdf4'
)
## load in packages
package_load(packages)
# Source functions -------------------------------------------------------------
purrr::map(list.files("R/", full.names = TRUE), source)
# Create outputs folder in root directory --------------------------------------
if (!dir.exists("outputs/")){
dir.create("outputs/")
}