-
Notifications
You must be signed in to change notification settings - Fork 1
/
_run_spf.R
46 lines (43 loc) · 1.93 KB
/
_run_spf.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
# for ...
source("R/read_objects_typo.R")
data <- read_objects_typo(ggdocument.url = "DATA_01_IT_VC_2.xlsx",
ggdocument.sheet = "Sites_NMI_MET",
authentificate = FALSE)
# for graphs + maps
source("R/read_objects_typo.R")
source("R/graph_objects_typo.R")
source("R/graph_objects_map.R")
data <- read_objects_typo(ggdocument.url = "DATA_01_IT_VC_2.xlsx",
ggdocument.sheet = "Ornament_IT_Archiv",
authentificate = FALSE)
selected.col.chrono <- c("GIIA.(600-550)",
"GIIAB.(550-525)", "GIIAB_IIB.(550-490)", "GIIB.(525-490)",
"GIIB_IIIA1.(525-450)",
"GIIIA1.(490-450)", "GIIIA1_GIIIA2.(490-420)", "GIIIA2.(450-420)")
selected.col.groups <- c("gr0", "gr1", "gr1", "gr1", "gr2", "gr3", "gr3", "gr3")
df.chrono <- data.frame(periods = selected.col.chrono,
groups = selected.col.groups,
stringsAsFactors = F)
data[,selected.col.chrono][is.na(data[,selected.col.chrono])] <- 0
ldegrees <- ldensities <- ldiameter <- lG <- list()
# subset obj by period
for(i in 1:length(unique(df.chrono$groups))){
# i <- 1
a.group <- unique(df.chrono$groups)[i]
periods <- df.chrono[df.chrono[, "groups"] == a.group, "periods"]
data.per <- data[, c(mandatory.fields, periods)]
data.per.sum <- data.per %>%
dplyr::rowwise() %>%
dplyr::mutate(per = sum(dplyr::c_across(dplyr::any_of(periods))))
# rename per
names(data.per.sum)[names(data.per.sum) == 'per'] <- a.group
data.per.sum <- data.per.sum[, c(mandatory.fields, a.group)]
data.per <- data.per.sum[data.per.sum[ , a.group] > 0, ]
# drop row with NA in mandatory columns
a.graph <- paste0(as.character(i), "_", a.group)
print(paste0("*read: ", a.graph))
ext.title <- paste0(periods, collapse = " & ")
map.per <- graph_objects_map(data.per, a.graph, ext.title)
grp.per <- graph_objects_typo(data.per, a.graph, ext.title)
# lG[[length(lG)+1]] <- aG
}