-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_sf_data_reading.R
46 lines (29 loc) · 1.02 KB
/
01_sf_data_reading.R
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
35
36
37
38
39
40
41
42
43
44
45
46
######
###### ENV
######
pacman::p_load(sf, sp, glmnet, ranger, kknn, gbm, spaMM, gstat,
spgwr, spdep, caret , Metrics, mccr,
geoR, raster, rgeos, sperrorest, ggplot2, gridExtra, tidyverse)
######
###### READ
######
list_files <- list.files(path = "./data/sampling_points_split/",
recursive = TRUE,
full.name = TRUE,
pattern = ".*_train\\.gpkg$") # Only include files ending with "_train.gpkg"
list_gpkg <- lapply(list_files, FUN = sf::read_sf)
######
###### TO INDIVIDUAL FILES
######
cordilleras <- c("Blanca","Central","Huallanca",
"Huayhuasha","Huaytapallana","LaRaya",
"LaViuda","Raura","Urubamba",
"Vilcabamba","Vilcanota")
for (i in seq_along(cordilleras)) {
variable_name <- paste0(cordilleras[i], "_train")
assign(variable_name, list_gpkg[[i]])
}
Blanca_train
Central_train
Huallanca_train
Huayhuasha_train